I have a char but when I run a check to see if it is nil, I get an exception Comparison between pointer and integer. This is my code:
char *character1 = 'B';
if (character1 != nil){
...
} else {
...
}
This is in objective c.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Characters are (usually) 8-bit integer values, while
nilis a pointer. Perhaps you want the NUL character,'\0':Notice the single quotes around the value mean it is of
chartype.