Adding newline character to printf() changes code behaviour

前端 未结 3 1135
遥遥无期
遥遥无期 2021-01-01 11:48

For some reason, adding \\n to printf() changes the behaviour of below code. The code without \\n prints (null) whereas t

3条回答
  •  伪装坚强ぢ
    2021-01-01 12:11

    Executing with no arguments argv[1] shall be NULL pointer. With argv[1] being NULL

    printf("%s", argv[1]);
    

    will invoke undefined behavior.

提交回复
热议问题