-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfreinds.c
50 lines (41 loc) · 941 Bytes
/
freinds.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
#include <stdio.h>
#define LEN 20
struct names
{
char first[LEN];
char last[LEN];
};
struct guy
{
struct names handle;
char favfood[LEN];
char job[LEN];
float income;
};
int main(void)
{
struct guy fellow[2] =
{
{
{"Ewen", "Villard"},
"grilled salmon",
"personality coach",
58112.00,
},
{
{"Rodeny", "Swillbelly"},
"triple",
"tabloid editor",
232400.00
}
};
struct guy *him;
printf("address #1: %p #2: %p\n", &fellow[0], &fellow[1]);
him = &fellow[0];
printf("pointer #1: %p #2: %p\n", him, him + 1);
printf("%zd\n", sizeof(fellow[0]));
printf("him->income is $%.2f: (*him) .income is $%.2f\n", him->income, (*him).income);
him++;
printf("him->favfood is %s: him->handle.last is %s\n", him->favfood, him->handle.last);
return 0;
}