Sudarshan's blogby Sudarshan Gaikaiwari

C auto magic string concatenation

May 22, 2006

void myfunc(char * msg)
{
printf(msg);
}
 
int _tmain(int argc, _TCHAR* argv[])```js 
{
printf("Hello "
"World\n");
myfunc("Hello "
"World\n");
 
return 0;
}

Well I did not know this but C concatenates adjacent string literals. The above example actually does print “Hello World” twice.


Edit on GitHub