且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

数组结束符\0与0的问题

更新时间:2022-05-03 12:29:45



  1. #include stdio.h>
  2. #include string.h>

  3. int main(int argc,char** argv)
  4. {
  5.     char s1[] = "abcd0xyz";
  6.     printf("s1 is %s\n",s1);

  7.     char s2[] = "abcd\0xyz";
  8.     printf("s2 is %s\n",s2);

  9.     return 0;
  10. }