creating new array according to input

Posted by gcc on Stack Overflow See other posts from Stack Overflow or by gcc
Published on 2010-05-09T09:13:59Z Indexed on 2010/05/09 9:18 UTC
Read the original article Hit count: 143

Filed under:
int *arrays[20],j,a=0;
/*int num_arrays;*/
char *tutar[200];
int /*fe*/i=0,n,temp;



do{
 tutar[i]=malloc(sizeof(int));

scanf("%s",tutar[i]);

temp=*tutar[i];

++i;
}

while(temp!='x'); int *arrays[20],j,a=0;

n=i; j=1; for(i=1;i

if(atoi(tutar[i])=='n') { ++j; arrays[j]=malloc(sizeof(int)); a=0; }

arrays[j][a]=*(int *)tutar[i];

if(atoi(tutar[i])=='x') break;

}

input:

 1 2 3 4 n 14 23 39 n 98 100 x

output:


arrays[1]:2 3 4
arrays[2]:14 23 39
arrays[3]:98 100

//i wanna output like that but my code didnt give me output like that
     //can anyone fix my code or (explain where is my error)

© Stack Overflow or respective owner

Related posts about c