#include <stdio.h>
main()
{
char *arr[40]={""};
char result[40][255]={""};
char str[] = "1||333|4444";
char *sp = "|";
int i;
int j=0;
int k=0;
for(i=0;str[i]!='\0';i++){
if(str[i]=='|'){
++j;
continue;
}
result[j][k++] = str[i];
if(str[i+1] == '|' || str[i+1] == '\0'){
k = 0;
arr[j] = result[j];
printf("%d-%s\n", j, result[j]);
}
}
printf("%s", (arr[0]));
scanf("%d", &i);
}
本回答被网友采纳