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

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

  •  28-06-2023
  •  | 
  •  

質問

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

役に立ちましたか?

解決

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;
      }
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top