为二维字符数组赋值
假设有一个二维数组
Code:- char article[3][20]={"/0"};
若要为 article[0] article[1] article[2] 赋值
Code:- //article[0]={"somewords here"}; 这样的形式是不正确的。
正确的写法应该是
Code:- strcpy(article[0],"someowords here");
该函数需要 string.h 头文件支持
Code:- #include<string.h>
长字符串的辅助测量方法
Code:- //-----------------012345678901234567890123456789012345678901234567890123456789012
- strcpy(article[0],"Hello everybody My name is Mutoo. I love programming very much!");
- strcpy(article[1],"You can contact me by my E-mail: 234775882@qq.com");
- strcpy(article[2],"Or visit my blog: http://blog.csdn.net/cmutoo");
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。