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

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

  •  28-06-2023
  •  | 
  •  

Frage

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

War es hilfreich?

Lösung

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;
      }
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top