[go: up one dir, main page]

0% found this document useful (0 votes)
13 views2 pages

Array of Structures

The document contains a C program that defines a structure for employee records, including fields for employee number, name, designation, and department. It prompts the user to input the number of employees and their respective details, storing them in an array of structures. Finally, it prints the inputted records of the employees.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Array of Structures

The document contains a C program that defines a structure for employee records, including fields for employee number, name, designation, and department. It prompts the user to input the number of employees and their respective details, storing them in an array of structures. Finally, it prints the inputted records of the employees.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<stdio.

h>

struct employee

int empl_no;

char name[30];

char designation[25];

char deptt[12];

}emp[10];

int main(){

int i,n;

printf("Enter the no. of employees\n");

scanf("%d", &n);

for(i=0;i<n;i++)

printf("\nEnter the employee record");

printf("\nEmployee number");

scanf("%d",&emp[i].empl_no);

fflush(stdin);

printf("\n name:");

gets(emp[i]. name);

printf("\ndesignation:");

gets(emp[i]. designation);
printf("\ndeptt:");

gets(emp[i].deptt);

printf("Inputted records of the employees are\n");

for(i=0;i<n;i++)

printf("\nEmployee number %d",emp[i].empl_no);

printf("\n name: %s",emp[i].name);

printf("\n designation: %s",emp[i].designation);

printf("\n department: %s",emp[i].deptt);

return 0;

You might also like