main()
{
char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}
Answer:
Behavior is implementation dependent.
Explanation:
The detail if
the char is signed/unsigned by default is implementation dependent. If the
implementation treats the char to be signed by default the program will print
–128 and terminate. On the other hand if it considers char to be unsigned by
default, it goes to infinite loop.
Rule:
You can write
programs that have implementation dependent behavior. But dont write programs
that depend on such behavior.
Blog Author: Vijay Kumar
No comments:
Post a Comment