NULL used in arithimetic problem.

I see no reason for that error. But it still gives me. I am irritated by it. How to remove it?
for (int n =0; (n < 20) && (equal == true) && (letter[n] != NULL); n++)
NULL is for use with pointers. Now I have no idea what the heck letter is cause you gave us so little context, but in C NULL is usually (void*)0, in C++ it's usually 0. Assuming that letter is an array of char, it might be a warning that you are attempting to compare an integer value to a pointer - which isn't an error, but maybe not what you want.
the NULL macro isn't type safe so generally I just don't use it. I just use zero and have yet to have a problem.
NULL expands to 0 in C++, which is always a correct value to compare to a pointer. In C it expands to (void*)0, which is also a correct value to compare to any pointer. How is this not type safe O_o? (though generally, you don't want any nulls in your code anyways).
Maybe you mean letter[n] != '\0' (the null character)? It won't work that way. And C++11 now has a nullptr keyword.
Topic archived. No new replies allowed.