C LANGUAGE - 19: STRUCTS IN C

 IN THIS TUTORIAL, WE WILL SEE ABOUT STRUCTS IN C:

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

struct Student{
    char name[50];
    char major[50];
    int age;
    double gpa;
};

int main() {
    struct Student student1;
    student1.age = 16;
    student1.gpa = 9.8;
    strcpy(student1.name, "Shayan");
    strcpy(student1.major, "Education");
   
    printf("%f", student1.gpa);


    return 0;

}

Comments

Popular posts from this blog

PYTHON FULL NOTES BY SHAYAN