2018年6月27日

摘要: 1 //运用strcat函数 2 #include<stdio.h> 3 #include<string.h> 4 int main(){ 5 char s1[100]="Tianjing,",s2[]="How are you"; 6 strcat(s1,s2); 7 puts(s1); 8 re 阅读全文
posted @ 2018-06-27 18:43 孙悟空son_ku_kong 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1 //char s1[100],s2[]="How are you!" 2 //s1=s2;错误!因为s1表示数组的第0个元素的地址,它为常量,不能被赋值 3 #include 4 #include 5 int main(){ 6 char s1[100],s2[]="How are you"; 7 strcpy(s1,s2); 8 puts(s1)... 阅读全文
posted @ 2018-06-27 18:42 孙悟空son_ku_kong 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 int main(){ 4 char s[100]; 5 gets(s); 6 printf("原字符串:%s\n",s); 7 printf("变大写字符串%s\n",strupr(s)); 8 printf("变小写字符串%s\n",strlwr(s)); 9 return ... 阅读全文
posted @ 2018-06-27 18:41 孙悟空son_ku_kong 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 int main(){ 4 char s1[100]; 5 gets(s1); 6 puts(s1); 7 printf("字符串长度:%d\n",strlen(s1)); 8 return 0; 9 } 阅读全文
posted @ 2018-06-27 18:40 孙悟空son_ku_kong 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 int main(){ 3 char s1[1]; 4 gets(s1); 5 puts(s1); 6 printf("%d\n",sizeof(s1)); 7 printf("%c\n",s1[1]); 8 return 0; 9 } 阅读全文
posted @ 2018-06-27 18:39 孙悟空son_ku_kong 阅读(113) 评论(0) 推荐(0) 编辑

导航