Hi everyone
I am new to C and new to this forum as well.
I need to create a student database which stores the name and roll number of the student.
I have almost no knowledge of how to create a database in c.
the program below is what i tried to do but honestly i don't understand what it actually does.
I can't understand if the name and roll number is replaced every time i press y or if it creates entirely a different file or record or something.
I also want to edit the database whenever i want but i don't see anything in the program that can help me edit the database i have created.
Code:
#include <stdio.h>
#include <conio.h>
#include <string.h>

void main()

{

FILE *a;
int sno;
char sname[20],any[1];

clrscr();

a=fopen("student.dat","a");

do
{
printf("Enter Student Number : ");
scanf("%d",&sno);

printf("Enter Student Name : ");
scanf("%s",sname);

printf(a,"%d %s \n",sno,sname);
printf("Do you wish to continue(Y/N)");
scanf("%s",any);
}while(strcmp(any,"y")==0);

fclose(a);

}
I would appreciate any help on creating a database.