+ 1
char b[]="abc"; char a[]="abc"; cout<<(a==b);
why this are not equal pls help
3 Respostas
+ 1
I think it's because characters only occupy one byte each while string characters occupy (I think) 2 bytes each.
0
codemonkey yes, I know. The question by Deepak Dhan was edited and he should have put an edit comment to avoid this confusion. He originally asked to compare a char array and a string.
0
What do you expect ?
a refers to the address of first character of the char array and same for the other one .
two addresses can not be same .