Structures
Student Record
Define a structure to store and display a student’s name and marks.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Define a structure to store and display a student’s name and marks.
#include <stdio.h>
struct Student {
char name[50];
float marks;
};
int main() {
struct Student s;
printf("Enter name: ");
scanf("%s", s.name);
printf("Enter marks: ");
scanf("%f", &s.marks);
printf("Name: %s, Marks: %.2f\n", s.name, s.marks);
return 0;
}
Alice
92.5
Name: Alice, Marks: 92.50