回复 9楼 给力芬2010
应该初始化没问题的···
回复 10楼 forever74
我试了一下改了,没重名,可是也还是不行····
#include<stdio.h> #include<stdlib.h> #include<time.h> #include<string.h> typedef struct { char suit[10]; char face[10]; }change; change card[52]; //全局变量 char *face[]={"1","2","3","4","5","6","7","8","9","10","jack","queen","king"}; char *suit[]={"spade","hearts","clubs","diamonds"}; void start(change card[],char *face[],char *suit[]) { int a; for(a=0;a<52;a++) { strcpy(card[a].face,face[a%13]); //原来的face[]是一个字符数组 现在的face为字符串数组指针 strcpy需要前后都为字符串 strcpy(card[a].suit,suit[a/13]); //求除 printf("%s\n",card[a].face); printf("%s\n",card[a].suit); } } int main() { start(card,face,suit); return 0; }