Char array initialization dilemma

后端 未结 3 1279
予麋鹿
予麋鹿 2020-12-07 03:53

Consider following code:

// hacky, since \"123\" is 4 chars long (including terminating 0)
char symbols[3] = \"123\";

// clean, but lot of typing
char symbo         


        
3条回答
  •  天命终不由人
    2020-12-07 04:16

    1) The problems you are mentioning are not problems. 2) Que: Is there a way to initialize char[] with string literal without terminating zero? -- you are already doing that.

提交回复
热议问题