Pelles C forum

C language => Beginner questions => Topic started by: darrenf on January 13, 2010, 07:25:50 AM

Title: Q. checking single character in string (char array)
Post by: darrenf on January 13, 2010, 07:25:50 AM
Hi,

Wonder if someone can help here.

I am trying to set up the condition....   if char
Title: Re: Q. checking single character in string (char array)
Post by: AlexN on January 13, 2010, 01:48:48 PM
Quote from: darrenf on January 13, 2010, 07:25:50 AM
>  charDebug.c(29): error #2168: Operands of '==' have incompatible types 'char' and 'char *'.
Try this:
if(lstr[wpos]==' ')
If you use " ", you define a string. if you use ' ', you define a charater.
Title: Re: Q. checking single character in string (char array)
Post by: darrenf on January 14, 2010, 02:51:29 AM
thanks Alex,  sitting here now wondering why I had not picked this up.
Your help is appreciated.