C Program To Print The ID And Name Of Each Student Using Struct #2
♣ Try it Out ::
#include<stdio.h> #include<conio.h> struct student { int id; char name[25]; }; int main() { struct student x; printf("Enter id & name for one student: \n"); scanf("%d", &x.id); scanf("%s", x.name); struct student *px; px = &x; printf("\nStudent id\t: %d \n", (*px).id); printf("Student name\t: %s \n", (*px).name); getch(); return(0); }
♣ Output ::
Enter id & name for one student: 1002020001 M.A.Muhit Student id : 1002020001 Student name : M.A.Muhit
♣ Downloads ::
Comments
Post a Comment