C: 如何正确声明一个字符串数组?

23 浏览
0 Comments

C: 如何正确声明一个字符串数组?

我看到了两种写法:

const char*  arr = {"foo", "bar"};

const char*  arr[] = {"foo", "bar"};

哪种是正确和通常标准的方式?

这两种有什么区别?

const char**arr = {"foo", "bar"};

const char* arr[] = {"foo", "bar"};

有什么区别?

还有

const char* * const arr = {"foo", "bar"};    

const char* const * const arr = {"foo", "bar"};

有什么区别?

0