Why can two string literals separated by a space, a tab, or "\ n" be compiled without errors?
int main()
{
char * a = "aaaa" "bbbb";
}
"aaaa" is char * "bbbb" - this is char *
There is no special concatenation rule for processing two string literals. And, obviously, the following code gives an error at compile time:
#include <iostream>
int main()
{
char * a = "aaaa";
char * b = "bbbb";
std::cout << a b;
}
Is this concatenation common to all compilers? Where is the zero termination of "aaaa"? Is "aaaabbbb" a contiguous RAM block?
source
share