print(int*a,int*b,int*c,int*d,int*e){
printf("\n%d %d %d %d %d %d",*a,*b,*c,*d,*e);
}
main(){
static int arr[]={97,98,99,100,101,102,103,104};
int *ptr=arr+1;
print(++ptr,ptr--,ptr,ptr++,++ptr);
return 1;
}
O/P: 100 100 100 99 100 (some -ve values)
on GCC & turbo C
According to my understanding, the ptr
points to 98
first, then ++ptr
is passed which makes it to point 99
.How in the world it prints 100
? Even then, it does not decrements the ptr
till 3rd argument and prints it again.What's going on?