Student Structure Program in C
Here you will learn to create a Student Structure Program in C programming. We will be using here structure in C language.
What is a structure in C
A structure is a user-defined data type that stores data in multiple variables of different data types. It is used to store related data and, It can be accessed using a single variable name.
Structure are used to represent a record, and each element in the structure is called a member.
Student Structure Program in C Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include<stdio.h> struct BAstudent { int roll; char name[30]; int age; }bs; int main() { printf("Enter Roll No : "); scanf("%d",&bs.roll); printf("Enter Name : "); scanf("%s",bs.name); printf("Enter Age : "); scanf("%d",&bs.age); printf("\nPrint data Record......\n"); printf("\nRoll: %d",bs.roll ); printf("\nName: "); puts(bs.name); printf("Age: %d",bs.age ); return 0; } |
Output
Enter Roll No : 101
Enter Name : Amit
Enter Age : 16
Print data Record……
Roll: 101
Name: Amit
Age: 16
Check out our other C programming Examples