google.com, pub-8786015629279405, DIRECT, f08c47fec0942fa0 Write a program to create array with in structure in C.

Write a program to create array with in structure in C.

0





//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();

 }

 


Output:

//Write a program to create array with in structure in C.



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Thank you for your interest 😊

We will back shortly after reviewing...

Thank you for your interest 😊

We will back shortly after reviewing...

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top