赞
踩
四种字符串初始化:
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;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。