Differences between single-quotes and double-quotes in C

前端 未结 5 475
梦如初夏
梦如初夏 2021-01-29 16:39

Recentely I have seen that if I use printf with \'foo\' I get a warning.

printf(\'numero\');

warning: character con

5条回答
  •  我在风中等你
    2021-01-29 16:59

    In c, ' is used for character constants, where as " is used for a string

    The printf function in c needs a string, so your code printf('numero'); will result an unexpected behavior.

    Instead, use printf("numero");

    You can read this small tutorial for more help

提交回复
热议问题