Hey guys,
Quick question about strings. Check out this piece of code:
#define compare_them(x,y) ((x) > (y) ? (x) : (y))
main()
{
cout<<compare_them('A','B')<<'\n';
cout<<compare_them("X","Y")<<'\n';
return 0;
}
The output is B, X. Obviously B has a higher ASCII value than A so it is larger. However when it comes to strings of X and Y, it seems that whatever string is listed first is returned. Me and a freind wrote the same code in C, however in C, Y is returned. I dont get it... help me out!
Thanks!