notesonly.in

One notebook for every subject — open it anywhere.

Log in

Structures, unions and file handling

Programming Fundamentals · Engineering

Study notes

Student record in C: struct Student { char name[50]; int roll; float cgpa; }; struct Student s1; strcpy(s1.name,"Ravi"); s1.roll=101; s1.cgpa=8.5; FILE *fp=fopen("students.dat","wb"); fwrite(&s1,sizeof(s1),1,fp); fclose(fp);

← Back to topics for Engineering