B
bintom
char str1[ ] = "abc", str2[ ] = "abc";
if(str1 == str2)
cout << "Identical";
else
cout << "Different";
I ran the above code on Dev C++ and the output was "Different" as
expected. In other words, the compiler compared the location of str1
and str2 in memory. But in, in the statement
cout << str1;
why does it return the string at str1 and not the memory address of
str1?
What is the technical jargon for this dual behaviour?
Thanks,
Bintom
if(str1 == str2)
cout << "Identical";
else
cout << "Different";
I ran the above code on Dev C++ and the output was "Different" as
expected. In other words, the compiler compared the location of str1
and str2 in memory. But in, in the statement
cout << str1;
why does it return the string at str1 and not the memory address of
str1?
What is the technical jargon for this dual behaviour?
Thanks,
Bintom