J
junky_fellow
i have a short C program as follows:
main()
{
int i=0;
i = ++i;
printf("\ni=%d",i);
}
when i compile the program, i get the following warning.
cc: Warning: test.c, line 6: In this statement, the expression "i=++i"
modifies the variable "i" more than once without an intervening
sequence point.
This behavior is undefined.
i = ++i;
^
I don't what causes the undefined bahaviour. For me the variable i
should
be incremented by 1. Also when i run the executable the value for i
printed
is 1.
main()
{
int i=0;
i = ++i;
printf("\ni=%d",i);
}
when i compile the program, i get the following warning.
cc: Warning: test.c, line 6: In this statement, the expression "i=++i"
modifies the variable "i" more than once without an intervening
sequence point.
This behavior is undefined.
i = ++i;
^
I don't what causes the undefined bahaviour. For me the variable i
should
be incremented by 1. Also when i run the executable the value for i
printed
is 1.