warning: comparison between pointer and integer

Hi guys :smiley:

I am still playing with my C handbook and yes, as you can see I have small problem as always :cool:

I wrote a C code
[C] #include <stdio.h> #define MESSAGE 100 int main(void) { char input_mes - Pastebin.com

And when I try to compile it I get following errors from gcc

14.c: In function �main':
14.c:33: warning: comparison between pointer and integer
14.c:35: warning: comparison between pointer and integer

I removed comments so code be more nice.

And this isn't my homework, it is a self-learnig so if this is a wrong place to put question please move it where belongs.

Thanks for reading :smiley:

You've got double quotes when you need single quotes:

(input_message[output] == " ")

The " " is a pointer to a string (of a single blank) while input_message[output] is a single character (converted to int for comparison).

Also, the statement input_message != " " won't ever evaluate to true, as you're comparing two pointers and not what the pointers reference. Have a look at strcmp() and strncmp() functions which I think will do what you want in this situation.

There may be other issues; I didn't look all that closely.