To store employee details we used structure array. Each element in the structure array represents the single employee.

Each Structure i.e Employee contains:

  • Name
  • Id
  • Salary

After taking input, we simply printed all employee details by iterating using for loop.

C Program to Read and Print Employee Details

Output of Program

C Program for Employee Details using Structure

If you didn’t understand any part of the code then do comment below.

This Post Has 11 Comments

  1. Balaji

    What is the difference between array and structure array

    1. Adarsh Kumar

      They both are similar. The difference is the type of data in the array. When we declare int array[10], we mean to store integers into the array and in case of Employee array[10], we mean to store structure objects into the array.

  2. Balaji

    Why you have write the Employee; after defining structure

    1. Adarsh Kumar

      Any name you put at the end of the structure declaration along with typedef at the beginning is used to rename the structure. In our case, we have renamed the structure as Employee. so that we can address the structure in main funtion using just Employee instead of struct Employee.

  3. Shaik Amin

    Write a program to read the details of ā€˜Nā€™ employees (ID, Name, Salary) and display the details of those employees whose salary is above Rs.10,000/-.
    Can any one write this program.?

    1. Adarsh Kumar

      The logic of your problem can be easily solved using the above program. Just include if(employees[i].salary> 10000) indide the loop which prints the employee details.

  4. Rekha

    1. Write a Menu Driven C program to create an employee database using structure and perform following operations: (I) Accept Employee Record (II) Display All Employees Records (III) Search Employee Record by name and Display (IV) Search Employee Record by Employee ID and Display (V) Update Employee Record (Note: Employee record will have following fields Employee ID, Employee Name, Employee Department, Employee Salary)

    can i pls get a code for this

  5. Ritik vani

    How to add date of joining of the employee in the program

    1. Adarsh Kumar

      Add another char array (string) to store the date of joining.

  6. Jayashree

    In case of storing 20 employees,we need to change ?

    1. Adarsh Kumar

      change the value of n

Leave a Reply