Recentely I have seen that if I use printf
with 'foo' I get a warning.
printf('numero');
warning: character constant too long for its type [enabled by default] warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast. /usr/include/stdio.h:362:12: note: expected ‘const char * restrict’ but argument is of type ‘int’ extern int printf (const char *__restrict __format, ...); warning: format not a string literal and no format arguments [-Wformat-security]
And when I use ""
I don't get any warnings printf("numero");
So, what's the difference between ''
and ""
?
In c,
''
is used for character constants and""
for string, unlike python where both can be used interchangeably.