I am trying to read from a file in C. My code is the following. It seems to read everything fine into the array, but when I try to print it, I get the error
Segmentation fault (core dumped)
FILE *fp; char * text; int i=0; fp = fopen("userList.txt", "r"); //Read over file contents until either EOF is reached or maximum characters is read and store in character array while(fgets((*text)[i++],100,fp) != NULL) ; printf("%s", &text); fclose(fp);
Can someone point me in the right direction?
I have tried reading and copying solutions from other similar cases, but they are extremely specific to the user.