#include<stdio.h>typedefstruct{int id;char fName[16];char lName[16];} s_employee;intmain(){//Populate variable of array of structure
s_employee sAticleworldEmplInfo[]={{1,"Amlendra","Mishra"},{2,"Pooja","Mishra"},{3,"Apoorv","Mishra"},{4,"Amitosh","Mishra"},{5,"Maya","Mishra"},{6,"Uday","Mishra"},};//file pointer
FILE *fp =NULL;//create and open the text file
fp =fopen("aticleworld.dat","wb");if(fp ==NULL){printf("Error in creating the file\n");exit(1);}//write the structure array in filefwrite(sAticleworldEmplInfo,sizeof(sAticleworldEmplInfo),1, fp);fclose(fp);return0;}
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer