C Program Of Nested Structure

C Program Of Nested Structure

#include<stdio.h>

struct student
{

int roll;
char name[20];

  struct stu_marks
   {

  char sub[20];
  int m;
   };
};

main()

{

printf("Enter student roll:\n");
scanf("%d",&st.roll);

printf("Enter student name:\n");
scanf("%s",st.name);

printf("Enter student sub name:\n");
scanf("%s",st.marks.sub);

printf("Enter student marks:\n");
scanf("%d",&st.marks.m);

printf("\nStudent Details:\n\n");

printf("Student Roll no. is:%d\n\nStudent name is:%s\n\nStudent subject name is:%s\n\nStudent marks is:%d\n\n",st.roll,st.name,st.marks.sub,st.marks.m);

}

Related Posts