C Program to Store Information(name, roll and marks) of a Student Using Structure

In this program, a structure(student) is created which contains name, roll and marks as its data member. Then, a structure variable( s ) is created. Then, data (name, roll and marks) is taken from user and stored in data members of structure variable s. Finally, the data entered by user is displayed.

C Program to Store Information of Single Variable

#include <stdio.h>
struct student{
    char name[50];
    int roll;
    float marks;
int main(){
    struct student s;
    printf("Enter information of students:\n\n");
    printf("Enter name: ");
    printf("Enter roll number: ");
    printf("Enter marks: ");
    printf("\nDisplaying Information\n");
    printf("Name: %s\n",s.name);
    printf("Roll: %d\n",s.roll);
    printf("Marks: %.2f\n",s.marks);
    return 0;


Store information using structure in C programming

Similar Examples