hello i have a warning error : passing arg1 of srtcmp makes pointer from integer
without cast.

here is a part of the code :

int calc ( char s[] ) {
int size = strlen(s) ;
int flag = 0 ;
char op ;
char add[] = "+" ;
char sub[] = "-" ;
for ( i=0 ; i<size ; i++ ) {
if ( flag == 0 && (strcmp(s[i],add)==0 || strcmp(s[i],sub)==0 )) {
    flag = 1 ;
    op = s[i] ;
      }
}

help please

Recommended Answers

All 2 Replies

Arguments of strcmp() should both be char pointers. In your case, the first argument is a char, which causes this error.

You can correct the problem like this: if ( flag == 0 && (s[i] == '+' || s[i] == '-' ))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.