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
What is wild pointer in c?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What is the size of array float a(10)?
show how link list can be used to repersent the following polynomial i) 5x+2
What is static and auto variables in c?
What is difference between static and global variable in c?
What is type qualifiers?
What is the purpose of void in c?
Explain what is wrong with this program statement?
What is the need of structure in c?
Why should I prototype a function?
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
What is array within structure?
what are bit fields in c?
What is the difference between c and python?