What is the difference between (char)0 and '\0'? in C

前端 未结 4 834
梦谈多话
梦谈多话 2020-12-24 12:23

What is the difference between using (char)0 and \'\\0\' to denote the terminating null character in a character array?

4条回答
  •  轮回少年
    2020-12-24 12:49

    Character array means You are taking String so I advise you to use '\0' at the end of character Array after reading all the Characters of from user because 0 is simple Character but '\0' is NULL which indicates end of String.

提交回复
热议问题