#include <stdio.h>
#include <string.h>
struct student {
char name[50];
int age;
float marks;
};
int main() {
struct student s1;
strcpy(s1.name, "John");
s1.age = 20;
s1.marks = 85.5;
printf("Student Name: %s\n", s1.name);
printf("Student Age: %d\n", s1.age);
printf("Student Marks: %.2f\n", s1.marks);
return 0;
}
Student Name: John
Student Age: 20
Student Marks: 85.50
student
that contains three members : name
, age
, and marks
. The program then creates an instance of the student
structure called s1
, initializes its members with values, and prints the student's name
, age
, and marks
using the printf
function.scanf
function and display information for multiple students by creating an array of student
structures.