• Home
  • Categories
    • WordPress Troubleshooting
    • WordPress Tips and Tricks
    • SSH (Secure Shell)
    • WordPress Insights
    • WordPress Common Facts
    • Securing WordPress
  • Series Tutorials
    • Advanced WordPress Topic
  • Privacy Policy
  • Terms of Use
  • Contact Me
  • About WP Tuts Hub
Home  /  C Programming • Computer 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

zubaer Structures in C Programming Leave a Comment
Share on Facebook Share on Twitter Share on Pinterest Share on StumbleUpon Share on Reddit Share on LinkedIn Share on tumblr
Email this article!

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:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

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 Author

zubaer

Hi, My name is Zubaer and I am a Web Devloper. Besides, I am Hybrid Mobile App Developer. My fields of proficiency are WordPress, Laravel, HTML, CSS, JavaScript, AngularJS and PHP. You can visit www.zubaer.com to know more about me.

Related Posts

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

    C Program to Store Multiple Student Records Using Structure and Pointer

Leave a Reply

Cancel reply




Popular Posts

  • Using Cron Job in WordPress - - Schedule Events With WP-Cron
    Using Cron Job in WordPress – Schedule Events With WP-Cron: Part 1 December 20, 2016
  • C Program to Store Multiple Student Records Using Structure and Pointer May 27, 2023
  • SSH Secure Shell Commands
    Frequently Used SSH (Secure Shell) Commands for a Web Developer September 7, 2016
  • Update WordPress site URL via PHPmyadmin
    WordPress Replace Old URL After Domain Change September 27, 2016

Categories

  • Advanced WordPress Topic2
  • C Programming2
  • Computer Programming2
  • Securing WordPress2
  • Series Tutorials2
  • SSH (Secure Shell1
  • WordPress Common Facts1
  • WordPress Insights2
  • WordPress Tips and Tricks4
  • WordPress Troubleshooting3

Calorie Calculator Pro

  • US Units
  • Metric Units
Please enter your age
Please enter your gender
Please enter your height
Please enter your weight (Pounds)
Please select an activity level
Your body fat percentage (optional)
Please enter your First Name
Please enter your Last Name
Please enter your best email address
Please enter your age
Please enter your gender
Please enter your height
Please enter your weight (Kg)
Please select an activity level
Your body fat percentage (optional)
Please enter your First Name
Please enter your Last Name
Please enter your best email address
Please enter your best email address
Problem? Try Another

Archives

  • May 20233
  • July 20171
  • December 20162
  • September 20162
  • July 20162

Tags

File Upload Error HTTP Error Prevent DDoS and Brute Force Attack Schedule Events Secure Shell Securing WordPress SSH SSH Commands Structure and Pointers in C Structures in C Programming Using Cron Job WordPress Administrator WordPress Common Facts WordPress Cron Job WordPress Error WordPress Insights WordPress Tips WordPress Tricks WP-Cron

My Services and Products

  • Hire Me or Contact Me
  • My WordPress Plugins and Themes
  • WeboCoder
  • Privacy Policy
  • Terms of Use
  • About Us

Subscribe

    Your Name (required)

    Your Email (required)

    Random Posts

    • SSH Secure Shell Commands
      Frequently Used SSH (Secure Shell) Commands for a Web Developer September 7, 2016
    • Top WordPress Plugins to Secure Your Website in 2023 May 27, 2023
    • Secure WordPress site from hacking, DDoS and Brute force attack
      How to Secure WordPress Site From Hacking, DDoS and Brute Force Attack December 5, 2016
    © WP Tuts Hub 2023.
     

    Loading Comments...