printf outputting garbage instead of specific characters

后端 未结 2 1902
清酒与你
清酒与你 2020-12-12 07:47

Well I\'ve weird problem with printf(). It\'s outputting garbage on screen. It\'s kind of connected with memory I guess. Have a look:

char strin         


        
2条回答
  •  温柔的废话
    2020-12-12 08:34

    Because C strings need to be NUL terminated. This means the last char of your string must be '\0'. This is how printf (and all other C string functions) know when a string is finished.

提交回复
热议问题