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

Why c is called procedure oriented language?

585


What is stack in c?

619


Is there a built-in function in C that can be used for sorting data?

751


What is the use of #include in c?

587


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.

2661






How can I write a function that takes a format string and a variable number of arguments?

611


Which is best linux os?

572


What is void main ()?

617


Describe the header file and its usage in c programming?

626


How do I copy files?

627


write a program to print data of 5 five students with structures?

1614


What is meant by recursion?

637


Write a program to swap two numbers without using third variable?

821


Write a code of a general series where the next element is the sum of last k terms.

598


Explain what is a program flowchart and explain how does it help in writing a program?

653