The code which is given below was asked by my teacher. It is just to test who can figure out the output with out running the code. For compiling Turbo C++ was used.
I am unable to understand how incrementing and decrementing happens in a function call and weather values are passed from left to right or right to left in the below code.
#include<stdio.h>
#include<conio.h>
int main(){
char c[]="hello";
char *p;
clrscr();
p=&c[0];
printf("%c %c %c ",++*p,*++p,*p++);
puts(c);
getchar();
return 0;
}
According to me the output is : iel iemlo
but when it compiled and run I got : m l h hemlo Why is this happening is the values are passed from right to left or some thing else ?
Thanks in advance.