1.void main(){
int i=4,x;
x=++i + ++i + ++i;
printf("%d",x);
}
In
++a, ++ is pre increment operator. In any mathematical expression pre
increment operator first increment the variable up to break point then
starts assigning the final value to all variable.
Step 1: Increment the variable I up to break point.

Step 2: Start assigning final value 7 to all variable i in the expression.

2.void main(){
int a=10;
printf("%d %d %d",a,a++,++a);
}
In c printf function follows cdecl parameter passing scheme. In this scheme parameter is passed from right to left direction.

No comments:
Post a Comment