I think I get understand how string works, but some how get a segmentation error when try to run this. I'm trying to create array of string that i read from file f. Also any comments for optimisation and or a better way to code (especially using pointer)is appreciated.
char a[700000][120];
char str[120];
int i=0,l,p;
while (fgets(str,120,f)) {
    strcpy(a[i],str);
    i++;
    }
int n=i;
for (i=0;i<=3;i++) {
    printf("%s\n",a[i]);
}
 
     
     
     
     
    