hello this is my first year in learning c programming , i spent all day trying to figure this one out and now i have a head ache anyway i just wanna keep this as simple as possible, here is a test code that i want to correct so i can understand how this works what i wanna do is store a dynamic array of structure variables in a text file, and then reading the data from that text file into a dynamic array. this is in c language
#include <stdio.h>
#include <stdlib.h>
struct student {
char nam[3]; // we store to this
char testname[3]; // we read to this
}*science[10];
int main() {
int i;
FILE *ptr=fopen("science_class","a");
for (i=0;i<3;i++){ //storing the infro from dynamic array into the file
e[i]=(science*)calloc(3,sizeof(char));
puts("enter name");
gets(science[i]->name);
fprintf(ptr,"%s",science[i]->name); }
for (i=0;i<3;i++){ // loading the info from the file to a dynamic array
fscanf(ptr,"%s",&science[i]->testname)
printf("name :%s \n",science[i]->testname) }
fclose(ptr);
}