user-0 提问: 数组是否可以存储汉字

回复:
user: user-1
content: 引用 9 楼 mokaihuai 的回复:谢谢大家热心的帮助。我不是一个新手，我是一个一直在进步的新手。 又见白马非马论。

user: user-0
content: 谢谢大家热心的帮助。我不是一个新手，我是一个一直在进步的新手。

user: user-2
content: 准确的说c 语言是不支持汉字的

user: user-3
content: 引用 3 楼 zhao4zhong1 的回复:#include <stdio.h> #include <locale.h> int main() {     int num;     char *remain;     char *a[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};      setlocale(LC_ALL,"chs");     if (1==scanf("%d",&num)) {         switch(num%7)         {             case 0: remain=a[0];break;             case 1: remain=a[1];break;             case 2: remain=a[2];break;             case 3: remain=a[3];break;             case 4: remain=a[4];break;             case 5: remain=a[5];break;             case 6: remain=a[6];break;         }         printf("%s\n",remain);         return 0;     } else return 1; }   赵老师，授人以不如授人以渔，楼主是个新手，你这样写可能他不懂，他也许分不清什么是字符串，什么是字符数组，什么是指针数组，什么是数组指针。。。。

user: user-1
content: 引用 6 楼 qq523176585 的回复:[quote=引用 3 楼 zhao4zhong1 的回复:] #include <stdio.h> #include <locale.h> int main() {     int num;     char *remain;     char *a[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};      setlocale(LC_ALL,"chs");     if (1==scanf("%d",&num)) {         switch(num%7)         {             case 0: remain=a[0];break;             case 1: remain=a[1];break;             case 2: remain=a[2];break;             case 3: remain=a[3];break;             case 4: remain=a[4];break;             case 5: remain=a[5];break;             case 6: remain=a[6];break;         }         printf("%s\n",remain);         return 0;     } else return 1; }   赵老师，授人以不如授人以渔，楼主是个新手，你这样写可能他不懂，他也许分不清什么是字符串，什么是字符数组，什么是指针数组，什么是数组指针。。。。[/quote] 电脑内存或文件内容只是一个一维二进制字节数组及其对应的二进制地址； 人脑才将电脑内存或文件内容中的这个一维二进制字节数组及其对应的二进制地址的某些部分看成是整数、有符号数/无符号数、浮点数、复数、英文字母、阿拉伯数字、中文/韩文/法文……字符/字符串、汇编指令、函数、函数参数、堆、栈、数组、指针、数组指针、指针数组、数组的数组、指针的指针、二维数组、字符点阵、字符笔画的坐标、黑白二值图片、灰度图片、彩色图片、录音、视频、指纹信息、身份证信息……

user: user-4
content: 原代码 #include "stdio.h"//这种写法不建议，这种双引号头文件一般是自己定义的。 main() {   int num;     char remain;//此处为一个字符，不能在下面与一个字符串赋值     char a[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};//概念模糊 数组a为字符型怎么能装下字符串。     scanf("%d",&num);     switch(num%7)     {         case 0: remain=a[0];break;//字符串之间不能直接等于，要用strcpy函数，头文件为string.h         case 1: remain=a[1];break;         case 2: remain=a[2];break;         case 3: remain=a[3];break;         case 4: remain=a[4];break;         case 5: remain=a[5];break;         case 6: remain=a[6];break;     }      printf("%s\n",remain); } 修改代码： #include <stdio.h> #include <string.h> main() {   int num;     char remain[7];      char a[7][7]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};     scanf("%d",&num);     switch(num%7)     {         case 0: strcpy(remain,a[0]);break;         case 1: strcpy(remain,a[1]);break;         case 2: strcpy(remain,a[2]);break;         case 3: strcpy(remain,a[3]);break;         case 4: strcpy(remain,a[4]);break;         case 5: strcpy(remain,a[5]);break;         case 6: strcpy(remain,a[6]);break;     }      printf("%s\n",remain); } 我觉得大致是这样的 你跑下试试

user: user-4
content: 原代码 #include "stdio.h"//这种写法不建议，这种双引号头文件一般是自己定义的。 main() {   int num;     char remain;//此处为一个字符，不能在下面与一个字符串赋值     char a[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};//概念模糊 数组a为字符型怎么能装下字符串。     scanf("%d",&num);     switch(num%7)     {         case 0: remain=a[0];break;//字符串之间不能直接等于，要用strcpy函数，头文件为string.h         case 1: remain=a[1];break;         case 2: remain=a[2];break;         case 3: remain=a[3];break;         case 4: remain=a[4];break;         case 5: remain=a[5];break;         case 6: remain=a[6];break;     }      printf("%s\n",remain); } 修改代码： #include <stdio.h> #include <string.h> main() {   int num;     char remain[7];      char a[7][7]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};     scanf("%d",&num);     switch(num%7)     {         case 0: strcpy(remain,a[0]);break;         case 1: strcpy(remain,a[1]);break;         case 2: strcpy(remain,a[2]);break;         case 3: strcpy(remain,a[3]);break;         case 4: strcpy(remain,a[4]);break;         case 5: strcpy(remain,a[5]);break;         case 6: strcpy(remain,a[6]);break;     }      printf("%s\n",remain); } 我觉得大致是这样的 你跑下试试

user: user-1
content: #include <stdio.h> #include <locale.h> int main() {     int num;     char *remain;     char *a[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};      setlocale(LC_ALL,"chs");     if (1==scanf("%d",&num)) {         switch(num%7)         {             case 0: remain=a[0];break;             case 1: remain=a[1];break;             case 2: remain=a[2];break;             case 3: remain=a[3];break;             case 4: remain=a[4];break;             case 5: remain=a[5];break;             case 6: remain=a[6];break;         }         printf("%s\n",remain);         return 0;     } else return 1; }

user: user-5
content: #include "stdio.h" int main() {  int num; char * remain; char a[][10]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"}; scanf("%d",&num); switch(num%7) { case 0: remain=a[0];break; case 1: remain=a[1];break; case 2: remain=a[2];break; case 3: remain=a[3];break; case 4: remain=a[4];break; case 5: remain=a[5];break; case 6: remain=a[6];break; }  printf("%s\n",remain); return 0; }

user: user-6
content: 引用 楼主 mokaihuai 的回复:#include "stdio.h" main() {   int num; 	char remain; 	char a[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"}; 	scanf("%d",&num); 	switch(num%7) 	{ 		case 0: remain=a[0];break; 		case 1: remain=a[1];break; 		case 2: remain=a[2];break; 		case 3: remain=a[3];break; 		case 4: remain=a[4];break; 		case 5: remain=a[5];break; 		case 6: remain=a[6];break; 	}  	printf("%s\n",remain); } 数组中能否存储汉字? 不明白本程序的错误。 额，好多错误啊。