当前位置:   article > 正文

字符串的初始化及数组、指针_字符串指针数组初始化

字符串指针数组初始化

四种字符串初始化:
1. const char m1 [40] = “Limit yourslef to one Line’s worth. “;
2. const char m2 [ ] = “If you can’t think of anything, fake it. “;
3. const char *m3 = “\nEnough about me - what’s your name? “;
4. const char *mytal[3] ={“aaaa”,”BBBB”,”cccc”};

错误的 初始化
const char *m2 [ ] = “If you ….”;
a. [ ] 优先级高于*,m2和[ ]先结合,表明是一个数组
b. m2 [ ]和*结合,表明数组元素是指针;
c. 最后和char结合,指针指向char;

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/392588
推荐阅读
相关标签
  

闽ICP备14008679号