What is pointer? Write a program to enter the name, mobile and post of employee and write it in file “worker.dat” in C program.



What is pointer? 

Answer this in comment......


Write a program to enter the name, mobile and post of employee and write it in file “worker.dat” in C program.
#include <stdio.h>
int main ( )
{
int n, i, m;
char n[10], p[10];
FILE *fp;
fp = fopen(“worker.dat”, “w”);
printf(“Enter the number of records”);
scanf(“%d”, &n);
printf(“Enter Name, Mobile and Post of employees”);
for(i=1; i<=n; i++)
{
	scanf(“%s %d %s”, n, &m, p);
	fprintf(fp, “%s %d %s”,  n, m, p);
}
fclose(fp);
return 0;
}

Post a Comment

0 Comments