I have a bit stupid question about program in C. My compiler says me: warning: comparison between pointer and integer. I really don\'t know why. I only want to writ
NULL
is a pointer and str[i]
is the i-th char of the str array. char is and integer type, and as you compare them you get the warning.
I guess you want to check for end of string, that would you do with a check for the char with the value 0 (end of string), that is '\0'
.
BUT: this wont help you as you define it just as and array of chars and not as a string, and you didnt define the termininating 0 in the char array (you get just lucky that it is implicit there).
PS: Next time you should give at least the information where the compiler is complaining.