What will be the output if you will execute following c code? #include<stdio.h> int main(){ int xyz=1000; int *ptr=&xyz; printf("%d %d",++xyz,(*(int *)xyz)--); return 0; }
printf function follows cedecl parameter passing convention. That is parameter will pass from right to left direction. (*(int *)ptr)β- = (*&val)β = valβ- Here β- post decrement operator. So first it will assign its value i.e. printf function will print 1234 and value of variable val will decrement by one. So val = 1233 Now second parameter will pass: ++val So, val = 1234