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 kind of structure is a house?
What is bash c?
What is the scope of global variable in c?
how to create duplicate link list using C???
How do you use a pointer to a function?
What are pointers? Why are they used?
Is it acceptable to declare/define a variable in a c header?
c program for searching a student details among 10 student details
What is "Duff's Device"?
What is else if ladder?
Why static variable is used in c?
Explain the difference between malloc() and calloc() in c?
What does %d do in c?
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
What is meant by keywords in c?