b14ck_5m0k3's blog

By b14ck_5m0k3, history, 23 months ago, In English

char S[3], T[3]; cin >> S[0] >> S[1] >> S[2]; cin >> T[0] >> T[1] >> T[2]; why (S == T) gives no correct output, when it is?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
23 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Because S and T refers to pointer to these arrays. If you compare them you will get the result of comparing two pointers, not arrays.