main函数接收子函数处理的数组,遍历数组时异常示例代码:#include #include #include voiddemo(char*list[]){inti;charname[10];for(i=0;i<10;i++){sprintf(name,"root%d",i);list[i]=name;printf("%d=>%s\n",i,list[i]);}}voidmain(){char**list;inti,len=10;//可变数组list=(char**)malloc(sizeof(char));demo(list);printf("\n");for(i=0;iprintf("%d=>%s\n",i,list[i]); }}
烙印99
相关分类