Hi,
Wonder if someone can help here.
I am trying to set up the condition.... if char
- in stringArray is ',' then do something
a sample code is below.
Peles C gives me the error....
> C:/progs> cc /c chardebug.c
> charDebug.c
> charDebug.c(29): error #2168: Operands of '==' have incompatible types 'char' and 'char *'.
some simple code in context of how I want to use it (solve this, solve problem) is....
------------ charDebug.c -----------------
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int countChar(char *);
int main(void)
{
char lstr[255];
sprintf(lstr,"10,45,67,89,ABC");
printf("\n\n the string has %d data items", countChar(lstr));
}
int countChar(char lstr[])
{
int fByte, wpos, numItems;
numItems=0;
fByte = strlen(lstr);
wpos = 1;
while (wpos<fByte)
{
if(lstr[wpos]==" ")
numItems++;
wpos++;
}
return(numItems);
}
----------------------------------------------------
thanks for your help.