I was just experimenting with code in C programming and found out weird behavior. Well ... Since I'm not an expert on C, so I don't know if this is strange or normal.
Basically, my question is about the difference between two lines of code: -
char a = 'h'; // here variable a is not an array of "char"
and
char a = 'hi';
I used the following codes
first: -
char a =0; for(;a<'hi';a++) { printf("%d= hello world \n",a); }
second: -
char a; for(a='h';a<'hi';a++) { printf("%d= hello world \n",a); }
both of the above loops continue to work forever,
Can someone tell me why so?
I may miss a very simple programming concept. please help me guys
source share