Chapter - 9: Arrays

How will you initialize a three-dimensional array threed[3][2][3]? How will you refer the first and last element in this array?


L
Sections
1
Exercises

A

B

C

D

E

F

G

H

I

J

K

L

1

2

3

4

5

6

7

8

9

10

11

13

14

15

16

17

18

19

#include<stdio.h>
#include<conio.h>
int main()
{
	int threed[3][2][3] = {
		{
			1, 2, 3,
			4, 5, 6
		},
		{
			7, 8, 9,
			10, 11, 12
		},
		{
			13, 14, 15,
			16, 17, 18
		}
	};
	printf("\nFirst element : %d", threed[0][0][0]);
	printf("\nLast element : %d", threed[2][1][2]);
	_getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo