WP Tuts Hub

  • 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

Warning: Trying to access array offset on value of type bool in /var/www/html/wp-content/themes/techblaze/template-parts/share-buttons.php on line 43

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
  • http error with wordpress file upload
    How to Fix HTTP Error in WordPress (Different Possible Ways) July 25, 2016
  • create new administrator account using mysql
    How to Create New WordPress Administrator via MySQL July 30, 2016
  • SSH Secure Shell Commands
    Frequently Used SSH (Secure Shell) Commands for a Web Developer September 7, 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

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)

    [recaptcha id:wptutshub_mailchimp_subscription class:wptutshub_mailchimp_subscription]

    Random Posts

    • WP Cron - All scheduled cron jobs
      Using Cron Job in WordPress – Schedule Events With WP-Cron: Part 2 July 10, 2017
    • http error with wordpress file upload
      How to Fix HTTP Error in WordPress (Different Possible Ways) July 25, 2016
    • 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
    © WP Tuts Hub 2023.
     

    Loading Comments...