Académique Documents
Professionnel Documents
Culture Documents
Structures
Structures
Here value of :
z.name is ‘s’.
z.pages is 125 and z.price is 90.0
It is equivalent to :
struct list {
int roll;
char name[10];
float marks;
}a, b, c;
Remember:
¾ The closing bracket of structure type
declaration must be followed by a
semicolon.
#include<stdio.h>
void main( )
{
struct student {
int roll;
char name[10];
float marks;
} a[10];
int j;
printf(“Enter all information of students:” );
for(j = 0 ; j < 10 ; j++)
scanf(“%d %s %f”, &a.roll[i], a.name[i], &a.marks[i]);
for(j = 0 ; j < 10 ; j++)
printf(“\n%d %s %f”, a.roll[i], a.name[i], a.marks[i]);
}
Memory map for arrays.
a[i].roll a[i].name a[i].marks i
2
a[5].roll
3
8 a[9].name
9
Created By,
Mr. Tushar B Kute,
Lecturer in Information Technology,
K. K. Wagh Polytechnic, Nashik.
tbkute@gmail.com