字符数组

#include<iostream>
using namespace std;
 int main()
 {
     char c[15]={'I',' ','a','m',' ','a',' ','s','t','u','d','e','n','t'};A正确 
     char c[15]={'I','M','a','m','M','a','M','s','t','u','d','e','n','t'};B错误//若不在M处打一个空格那么在编译时会提示空字符 
     for(int i=0;i<15;i++)
       cout<<c[i];
     cout<<endl;
     return 0;
 }

 

posted @ 2020-12-26 16:06  0never  阅读(46)  评论(0编辑  收藏  举报