-
Notifications
You must be signed in to change notification settings - Fork 0
/
address.c
60 lines (51 loc) · 1.43 KB
/
address.c
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Enter address (house no,block,city, state)of city
#include <stdio.h>
#include <string.h>
struct address
{
int houseNo;
int block;
char city[100];
char state[100];
};
void printAdd(struct address add);
int main()
{
struct address adds[5];
// input
printf("Enter info for person 1: ");
scanf("%d", &adds[0].houseNo);
scanf("%d", &adds[0].block);
scanf("%s", adds[0].city);
scanf("%s", adds[0].state);
printf("Enter info for person 2: ");
scanf("%d", &adds[1].houseNo);
scanf("%d", &adds[1].block);
scanf("%s", adds[1].city);
scanf("%s", adds[1].state);
printf("Enter info for person 3: ");
scanf("%d", &adds[2].houseNo);
scanf("%d", &adds[2].block);
scanf("%s", adds[2].city);
scanf("%s", adds[2].state);
printf("Enter info for person 4: ");
scanf("%d", &adds[3].houseNo);
scanf("%d", &adds[3].block);
scanf("%s", adds[3].city);
scanf("%s", adds[3].state);
printf("Enter info for person 5: ");
scanf("%d", &adds[4].houseNo);
scanf("%d", &adds[4].block);
scanf("%s", adds[4].city);
scanf("%s", adds[4].state);
printAdd(adds[0]);
printAdd(adds[1]);
printAdd(adds[2]);
printAdd(adds[3]);
printAdd(adds[4]);
return 0;
}
void printAdd(struct address add)
{
printf("address is: %d, %d, %s, %s \n", add.houseNo, add.block, add.city, add.state);
}