I am doing a lexical analysis program and this is a part of the code that counts number of keywords
int keyword=0;
char str[]="int float + - 78";
char* ptr;
ptr=strtok(str," ");
while(ptr!=NULL)
{
if(((strcmp(ptr,"int"))||(strcmp(ptr,"float")))==0)
keyword++;
ptr=strtok(NULL," ");
}
cout<<keyword;
to my knowledge there is no imbalance of parantheses in the if statement and the tokening loop also works fine ...the desired output is 2 but the output here is 0....can anyone help
thanks in advance