//Write a program to create array with in structure in C. #include<stdio.h> #include<conio.h> #include<string.h> //Structure is Created with
Array struct abc { char name[20]; int rollno; float marks[5]; }; // Initialization a Structure void main() { struct abc s1; int i; clrscr(); printf("Enter the
name\n"); scanf("%s",s1.name); printf("\nEnter the roll
no\n"); scanf("%d",&s1.rollno); printf("\nEnter the
Marks\n"); for(i=0;i<5;i++) { scanf("%f",&s1.marks[i]); } // Accessing structure member printf("the name
is-%s",s1.name); printf("\nthe roll no
is-%d",s1.rollno); printf("\nthe Marks
is-\n"); for(i=0;i<5;i++) { printf("\n%f",s1.marks[i]); } getch(); } |
Write a program to create array with in structure in C.
Sunday, May 10, 2020
0
Share to other apps