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 pointers in c with example?
What is #line used for?
What is the method to save data in stack data structure type?
Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?
What are data types in c language?
What is signed and unsigned?
Is it fine to write void main () or main () in c?
Write a program for finding factorial of a number.
How can I dynamically allocate arrays?
How can I read in an object file and jump to locations in it?
How to create struct variables?
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
How do I convert a string to all upper or lower case?
main() { printf("hello"); fork(); }
What is uint8 in c?