I am practicing Pointer Arithmetic but printf statement has a confusing response. My understandin says first 101 should be printed and then increment should occur. But here the problem goes...
#include <stdio.h>
int main()
{
int a[] = {101, 276, 345};
int *ptr = a;
printf ("%d\n%d\n", *ptr, *(++ptr) );
return 0;
}
It produces the following output
276
276
But, when I change the code to following
#include <stdio.h>
int main()
{
int a[] = {101, 276, 345};
int *ptr = a;
printf ("%d\n", *ptr);
return 0;
}
Result is following
101