This causes a segmentation fault:
char str1[60];
char**array;
array=malloc( str_nos * sizeof(char *) );
array[i]=malloc( str_len * sizeof(char *) );
strcat(array[i],str1);
strcat(array[i]," ");
str1
is taken from scanf
and it's shorter than 60 characters. array[i]
is from a dynamic array of strings.
Do you have any idea of what causes the problem? It happens only for a great amount of scanf
s.