Proper way to initialize a string in C

后端 未结 11 1261
臣服心动
臣服心动 2021-02-01 08:23

I\'ve seen people\'s code as:

char *str = NULL;

and I\'ve seen this is as well,

char *str;

I\'m wonder, what

11条回答
  •  逝去的感伤
    2021-02-01 09:06

    Global variables are initialized with default values by a compiler, but local variables must be initialized.

提交回复
热议问题