c – Warning comparison between pointer and integer
c – Warning comparison between pointer and integer
It should be
if (*message == �)
In C, simple quotes delimit a single character whereas double quotes are for strings.
This: �
is a string, not a character. A character uses single quotes, like �
.
c – Warning comparison between pointer and integer
In this line …
if (*message == �) {
… as you can see in the warning …
warning: comparison between pointer and integer (int and char *)
… you are actually comparing an int
with a char *
, or more specifically, an int
with an address to a char
.
To fix this, use one of the following:
if(*message == �) ...
if(message[0] == �) ...
if(!*message) ...
On a side note, if youd like to compare strings you should use strcmp
or strncmp
, found in string.h
.
Related posts on Integer :
- java – Integer.class vs int.class
- how to put a string into an integer array c++
- integer – Whats the maximum value for an int in PHP?
- math – What is the fastest integer factorization algorithm?
- Integer or int in Processing?
- c – How big can a 64 bit unsigned integer be?
- java – Finding the second smallest integer in array
- python – Plotly Express timeline for Gantt Chart with integer xaxis?