S
sangeeta chowdhary
Hey guys I am having problem to understand output of this code-
#include<stdio.h>
int main(int j)
{
int i=10,a;
a=i++ / ++i ;
printf("%d. .%d ",a,i);
return 0;
}
As we know postfix ++ has higher precedence than prefix ++ ,and then /
operator.
According to me, i will be incremented to 11 in i++,but 10 will be
used in exp,then ++i should give 12.
so 10/12 will give 0 as integer.
But i am getting 1..12 in gcc.
#include<stdio.h>
int main(int j)
{
int i=10,a;
a=i++ / ++i ;
printf("%d. .%d ",a,i);
return 0;
}
As we know postfix ++ has higher precedence than prefix ++ ,and then /
operator.
According to me, i will be incremented to 11 in i++,but 10 will be
used in exp,then ++i should give 12.
so 10/12 will give 0 as integer.
But i am getting 1..12 in gcc.