Programming in C 312303 Manual Practical No 20 Implement ‘Array of Structure’ in C Answer
In this Programming in C 312303 Manual practical no.20, we are going to learn how to Implement ‘Array of Structure’ in C and answer the practical related questions.
An array of structures in C is like having a bunch of containers that hold different kinds of information about different things, like people or animals. It’s a way to keep track of lots of different things all together. By using arrays of structures, students can write programs that organize and store information helpfully.
Exercise
1.Accept and Display 10 employees ’s information using structure.
Answer:
#include <stdio.h>#include <string.h> // For string operations (strcpy)struct Employee {int id;char name[50];float salary;};int main() {struct Employee employees[10]; // Array of 10 Employee structures// Input loop for employee informationfor (int i = 0; i < 10; i++) {printf(“nEnter details for Employee %d:n”, i + 1);printf(“ID: “);scanf(“%d”, &employees[i].id);printf(“Name: “);// Use fgets to avoid buffer overflow issues with namesfgets(employees[i].name, sizeof(employees[i].name), stdin);// Remove trailing newline character from name (optional)employees[i].name[strcspn(employees[i].name, “n”)] = ‘




A good web site for answer and a very nice to readable like your web site.
Pe. No. 20
A good website
Please give 20 to 25 pic practical