Is this the right statement for string comparison of two strings? [closed]

StackOverflow https://stackoverflow.com/questions/22881800

  •  28-06-2023
  •  | 
  •  

Pregunta

if(strcmp(p[pas].origin,"West")&&strcmp(p[pas].destination,"East")==0)
      {
       cost[pas]=5.62+5.62;
      }

is this the right code for the two input strings? or is there something wrong since the program runs but i cannot get the return value

¿Fue útil?

Solución

Didn't run but should be like this

if((strcmp(p[pas].origin,"West")==0) && (strcmp(p[pas].destination,"East")==0)
      {
       cost[pas]=5.62+5.62;
      }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top