36 lines
506 B
C
Raw Normal View History

2025-01-07 21:10:07 +01:00
#include <stdio.h>
struct student
{
char name[50];
int age;
};
/* function prototype*/
struct student getInformation();
int main()
{
struct student s;
s = getInformation();
printf("\nDisplaying information\n");
printf("Name: %s", s.name);
printf("\nRoll: %d", s.age);
return 0;
}
struct student getInformation()
{
struct student s1;
printf("Enter name: ");
scanf ("%[^\n]%*c", s1.name);
printf("Enter age: ");
scanf("%d", &s1.age);
return s1;
}