-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3dimarr.c
More file actions
76 lines (71 loc) · 1.45 KB
/
3dimarr.c
File metadata and controls
76 lines (71 loc) · 1.45 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* 3dimarra.c -- example of an 3 dimensional array */
#include <stdio.h>
#define APT 2
#define FLOOR 5
#define ROOM 4
#define SIZE 3
int main(void)
{
const float apt[APT][FLOOR][ROOM][SIZE] =
{
{
{25.6,30.5,50},
{30,23.5,40.6},
{45,23.5,10.6}
},
{
{25.6,30.5,30},
{30,23.5,40.6},
{45,23.5,10.6}
},
{
{25.6,30.5,50},
{30,23.5,40.6},
{45,23.5,10.6}
},
{
{25.6,30.5,50},
{30,23.5,40.6},
{45,23.5,10.6}
}
},
{
{
{25.6,30.5,50},
{30,23.5,40.6},
{45,23.5,10.6}
},
{
{25.6,30.5,30},
{30,23.5,40.6},
{45,23.5,10.6}
},
{
{25.6,30.5,50},
{30,23.5,40.6},
{45,23.5,10.6}
},
{
{25.6,30.5,50},
{30,23.5,40.6},
{45,23.5,10.6}
}
};
int floor, room, size;
for(int apt = 0; apt < APT; apt++)
{
for( floor = 0; floor < FLOOR; floor++)
{
printf("FLOOR : %d\n", floor);
for(room = 0; room < ROOM; room++)
{
printf("ROOM: %d\n", room);
printf("WIDTH HEIGHT LENGHT\n");
for(size = 0; size < SIZE; size++)
{
printf("%2.1f ", apt[floor][room][size]);
}
printf("\n\n");
}
}
}