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
Why c is called procedure oriented language?
What is stack in c?
Is there a built-in function in C that can be used for sorting data?
What is the use of #include in c?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
How can I write a function that takes a format string and a variable number of arguments?
Which is best linux os?
What is void main ()?
Describe the header file and its usage in c programming?
How do I copy files?
write a program to print data of 5 five students with structures?
What is meant by recursion?
Write a program to swap two numbers without using third variable?
Write a code of a general series where the next element is the sum of last k terms.
Explain what is a program flowchart and explain how does it help in writing a program?