I was just experimenting a code in C programming. and came to know a strange behavior. Well... Since i am not an expert on C, so i don't know whether its strange or normal.
Basically my question is all about the difference between the following two lines of code:-
char a = 'h'; // here variable a is not an array of "char"
and
char a = 'hi'; //here variable a is not an array of "char" as well (i don't know if compiler assumes it as an array or not but , at least i didn't declared it that way )
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 mentioned loops keep running forever,
Can somebody tell me why so ?
I might be missing a very basic concept of programing. please help me guys