int arr[] = {1,2,3,4}
int *ptr=arr;

*(arr+3) = *++ptr + *ptr++;

Final contents of arr[]

Answer Posted / anag

*(arr+3)------>arr[0][3] that means the there is any chnage
in the last value of an array
{1,2,3,--}

we know ++ has higher prededence than * so
*++ptr---->*(++ptr)
*(++ptr)----> increment in the location after that it point
to the value
it represent the second location of an array
* represent the value at this address
the value at the second location is 2.
in the second expression first it refer the value after
that it increment in the location
ptr currently points to the second location . ptr holds
that location for the second expression * represent the
value at that location that is 2.
so 2+2->4
{1,2,3,4} ----------->ans
suppose if we add a another expression after this that *ptr
then it print the value 3
because previous expression increment the location of the
value
Thank you

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is wild pointer in c?

796


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

850


What is the size of array float a(10)?

887


show how link list can be used to repersent the following polynomial i) 5x+2

1891


What is static and auto variables in c?

781


What is difference between static and global variable in c?

749


What is type qualifiers?

853


What is the purpose of void in c?

789


Explain what is wrong with this program statement?

849


What is the need of structure in c?

777


Why should I prototype a function?

826


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

914


What is array within structure?

821


what are bit fields in c?

1165


What is the difference between c and python?

799