-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructure3.c
More file actions
41 lines (40 loc) · 908 Bytes
/
structure3.c
File metadata and controls
41 lines (40 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Write a program to enter address (house no,block,city,state) of 5 people
#include<stdio.h>
typedef struct address
{
int houseNo;
int block;
char city[100];
char state[100];
}addres;
void dataEntry(addres *a);
void printData(addres a);
int main()
{
addres a[5];
printf("Enter address below \n");
for(int i=0;i<5;i++)
{
dataEntry(&a[i]);
}
printf("We have these records \n");
for(int i=0;i<5;i++)
{
printData(a[i]);
}
}
void dataEntry(addres *a)
{
printf("Enter House No : ");
scanf("%d",&a->houseNo);
printf("Enter Block No : ");
scanf("%d",&a->block);
printf("Enter City : ");
scanf(" %[^\n]s",a->city);
printf("Enter state : ");
scanf(" %[^\n]s",a->state);
}
void printData(addres a)
{
printf("House No :%d, Block :%d, City :%s, State :%s \n",a.houseNo,a.block,a.city,a.state);
}