While reading strings from a file, I'm having a lil problem, what's wrong here it doesnt give any error or warning but while running it gets crashed.
Code:int main(){ FILE* r; int i=0; int k=0; int number[SIZE]; int number2[SIZE]; char *name[SIZE]; char *name2[SIZE]; r=fopen("xxx.dat","r"); for ( i=0;i<SIZE;i++){ name[i]=(char*)malloc(15*sizeof(char)); name2[i]=(char*)malloc(15*sizeof(char )); } i=0; do{ fscanf( r,"%d %s %s %d",&number[i],&name[i],&name2[i],&number2[i]); i++;}while(i!=SIZE); //I put the string's anpersants away but still gets crashed.



LinkBack URL
About LinkBacks



