WP Tuts Hub

WordPress Tutorials, Themes and Plugins Hub
Advertisement

Browse

  • Home
  • Categories
    • WordPress Troubleshooting
    • WordPress Tips and Tricks
    • SSH (Secure Shell)
    • WordPress Insights
    • WordPress Common Facts
    • WordPress Security
  • Series Tutorials
    • Advanced WordPress Topic
  • Privacy Policy
  • Terms of Use
  • Contact Me
  • About WP Tuts Hub
Home/C Programming/C Program to Store Multiple Student Records Using Array of Structures
C Programming
May 27, 2023

C Program to Store Multiple Student Records Using Array of Structures

  • Structures in C Programming

This C program allows users to input the number of students, store student records as a structure in an array and print student information. In this C Program below we will store the student’s name, roll, age and CGPA and eventually print them.

Program:

#include <stdio.h>
#include <stdlib.h>

struct Student
{
    char name[30];
    long int roll;
    int age;
    float cgpa;
};

int main()
{
    int n;
    
    printf("Please enter the number of students: ");
    scanf("%d", &n);
    
    struct Student stuarr[n];

    for(int i=0; i< n; i++) 
    {
        printf("Please enter student %d's info: \n", i+1);
        printf("Name: "); 
        scanf("%s", stuarr[i].name);
        printf("Roll: "); 
        scanf("%ld", &stuarr[i].roll);
        printf("Age: "); 
        scanf("%d", &stuarr[i].age);
        printf("CGPA: "); 
        scanf("%f", &stuarr[i].cgpa);
        printf("\n");
    }
    
    for(int i=0; i< n; i++) 
    {
        printf("Student %d info: \n", i+1);
        printf("Name: %s\n", stuarr[i].name);
        printf("Roll: %ld\n", stuarr[i].roll);
        printf("Age: %d\n", stuarr[i].age);
        printf("CGPA: %f\n", stuarr[i].cgpa);
        printf("\n");
    }
    

    return 0;
}

Output:

Share this:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Reddit (Opens in new window) Reddit
  • Email a link to a friend (Opens in new window) Email

Related

Previous Article Using Cron Job in WordPress – Schedule Events With WP-Cron: Part 2
Next Article Top WordPress Plugins to Secure Your Website in 2023

About the author

Md. Zubaer Ahammed
Md. Zubaer Ahammed

Md. Zubaer Ahammed is a senior full-stack developer building learning platforms and modern web systems with WordPress, Laravel, Python/Django, Vue, and React. More at https://zubaer.com/.

Related Posts

  • C Program to Store Multiple Student Records Using Structure and Pointer

Leave a Reply

Cancel reply

WP Tuts Hub

WordPress tutorials, themes, and plugins — written for builders.

  • Portfolio
  • Calorie Calculator Pro
  • Contact
  • About
  • Privacy
  • Terms

© 2026 WP Tuts Hub · Md. Zubaer Ahammed

Loading Comments...