-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2darraynestedloop.c.save
More file actions
81 lines (56 loc) · 1.75 KB
/
2darraynestedloop.c.save
File metadata and controls
81 lines (56 loc) · 1.75 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
75
76
77
78
79
80
81
/*@Shyed Shahriar Housaini
Copyright: @uthor*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <windows.h>
///#include <threads.h>
#include <conio.h>
#include <dos.h>
int main(void)
{
///[3][3] number of elements in 2 dimensional array.
///[3][2] number of elements in 2 dimensional array.
int nums2[3][3] =
{ { 11, 12, 7}, /// 1 is indexed [0][0].
{13 , 14, 8},
{ 1 , 16 , 9}
}; /// 2d array with undeclared elements.
printf("%d \n", nums2[0][0]); /// 0 index number first element of the first array indexed 0.
printf("%d \n", nums2[0][1]);
printf(" %d \n", nums2[0][2]);
printf(" %d \n", nums2[1][2]);
printf(" %d \n", nums2[0][3]);
printf("%d \n", nums2[1][0]);
printf("%d \n", nums2[1][1]);
printf("%d \n", nums2[1][2]);
printf("%d \n", nums2[2][1]);
int nums[3][2] =
{ { 1, 2}, /// 1 is indexed [0][0].
{3 , 4},
{ 5 , 6 }
};
printf("%d \n", nums[0][0]); /// 0 index number first element of the first array indexed 0.
printf("%d \n", nums[0][1]);
printf(" Bug %d \n", nums[0][2]);
printf(" Bug %d \n", nums[0][3]);
printf("%d \n", nums[1][0]);
printf("%d \n", nums[1][1]);
int nums3[4][4]; /// Declare a 2d array with 4 elements row and column.
nums3[1][0]=10; /// Assigning a variable element in the array.
itn i,j;
int nums2[3][3] =
{ { 11, 12, 7}, /// 1 is indexed [0][0].
{13 , 14, 8},
{ 1 , 16 , 9}
}
for (i=0; i< 3; i++)
{
for (j = 0 ; j < 3 , j++)
{
printf(" %d, ", nums2[i][j]);
}
}
return 0;
}