C语言学习(10)

 1 //char s1[100],s2[]="How are you!"
 2 //s1=s2;错误!因为s1表示数组的第0个元素的地址,它为常量,不能被赋值
 3 #include <stdio.h>
 4 #include <string.h>
 5 int main(){
 6     char s1[100],s2[]="How are you";
 7     strcpy(s1,s2);
 8     puts(s1);
 9     strcpy(s1,"I am fine");
10     puts(s1);
11     return 0;
12 }

猜你喜欢

转载自www.cnblogs.com/Tobi/p/9235533.html