Using Struct C

 struct Student

{

char name[50];

char major[50];

int age;

double gpa;

};


int main()


{

struct Student student1;

    {

    strcpy(student1.name, "Brad");

    strcpy(student1.major, "Phornography");

    student1.age = 18;

    student1.gpa = 89.2;

    };


    printf("Name: %s\n", student1.name);

    printf("Major: %s\n", student1.major);

    printf("Age: %d\n", student1.age);

    printf("GPA: %f\n", student1.gpa);


    return 0;

}


Comments

Popular posts from this blog

arrays in c programming

for loop with index in C