Reema Thareja
Programming in C
© Oxford University Press 2018. All rights reserved.
CHAPTER 5
Arrays
© Oxford University Press 2018. All rights reserved.
Introduction
• An array is a collection of similar data elements.
• These data elements have the same data type.
• The elements of the array are stored in consecutive memory locations and are referenced by an index
(also known as the subscript).
• Declaring an array means specifying three things:
 Data type - what kind of values it can store. For example, int, char, float
 Name - to identify the array
 Size- the maximum number of values that the array can hold
• Arrays are declared using the following syntax.
type name[size];
1st
element
2nd
element
3rd
element
4th
element
5th
element
6th
element
7th
element
8th
element
9th
element
10th
element
marks[0] marks[1] marks[2] marks[3] marks[4] marks[5] marks[6] marks[7] marks[8] marks[9]
© Oxford University Press 2018. All rights reserved.
Accessing Elements of an Array
• To access all the elements of the array, you must use a loop. That is, we can access all the elements
of the array by varying the value of the subscript into the array.
• But note that the subscript must be an integral value or an expression that evaluates to an integral
value.
int i, marks[10];
for(i=0;i<10;i++)
marks[i] = -1;
© Oxford University Press 2018. All rights reserved.
Calculating the Address of Array Elements
Address of data element, A[k] = BA(A) + w( k – lower_bound)
Here
A is the array
k is the index of the element of which we have to calculate the address
BA is the base address of the array A
w is the word size of one element in memory, for example, size of int is 2
Address(Marks[4]) = 1000 + 2(4 – 0)
= 1000 + 2(4) = 1008
99 67 78 56 88 90 34 85
Marks[0] marks[1] marks[2] marks[3] marks[4] marks[5] marks[6] marks[7]
marks[7] 1000 1002 1004 1006 1008 1010 1012
1014
© Oxford University Press 2018. All rights reserved.
Calculating the Length of an Array
Length = upper_bound – lower_bound + 1
Where upper_bound is the index of the last element
and lower_bound is the index of the first element in the array
99 67 78 56 88 90 34 85
Marks[0] marks[1] marks[2] marks[3] marks[4] marks[5] marks[6 marks[7]]
Here,
lower_bound = 0, upper_bound = 7
Therefore, length = 7 – 0 + 1 = 8
© Oxford University Press 2018. All rights reserved.
Storing Vales in Arrays
Store values in the array
Initialize the elements
Input values for the elements
Assign values to the elements
Initialization of Arrays
Arrays are initialized by writing,
type array_name[size]={list of values};
int marks[5]={90, 82, 78, 95, 88};
int i, marks[10];
for(i=0;i<10;i++)
scanf(“%d”, &marks[i]);
Assigning Values
int i, arr1[10], arr2[10];
for(i=0;i<10;i++)
arr2[i] = arr1[i];
Inputting Values
© Oxford University Press 2018. All rights reserved.
Write a Program to Read and Display N Numbers Using an
Array
#include<stdio.h>
#include<conio.h>
int main()
{
int i=0, n, arr[20];
clrscr();
printf(“n Enter the number of elements : ”);
scanf(“%d”, &n);
for(i=0;i<n;i++)
{
printf(“n Arr[%d] = ”, i);
scanf(“%d”,&arr[i]);
}
printf(“n The array elements are ”);
for(i=0;i<n;i++)
printf(“Arr[%d] = %dt”, i, arr[i]);
return 0;
}
© Oxford University Press 2018. All rights reserved.
Inserting an Element in the Array
Algorithm to insert a new element to the end of the array.
Step 1: Set upper_bound = upper_bound + 1
Step 2: Set A[upper_bound] = VAL
Step 3: EXIT
The algorithm INSERT will be declared as INSERT( A, N, POS, VAL).
Step 1: [INITIALIZATION] SET I = N
Step 2: Repeat Steps 3 and 4 while I >= POS
Step 3: SET A[I + 1] = A[I]
Step 4: SET I = I – 1
[End of Loop]
Step 5: SET N = N + 1
Step 6: SET A[POS] = VAL
Step 7: EXIT
© Oxford University Press 2018. All rights reserved.
Deleting an Element From the Array
Algorithm to delete an element from the end of the array
Step 1: Set upper_bound = upper_bound - 1
Step 2: EXIT
Step 1: [INITIALIZATION] SET I = POS
Step 2: Repeat Steps 3 and 4 while I <= N - 1
Step 3: SET A[I] = A[I + 1]
Step 4: SET I = I + 1
[End of Loop]
Step 5: SET N = N - 1
Step 6: EXIT
The algorithm DELETE will be declared as DELETE( A, N, POS).
© Oxford University Press 2018. All rights reserved.
Linear Search
LINEAR_SEARCH(A, N, VAL, POS)
Step 1: [INITIALIZE] SET POS = -1
Step 2: [INITIALIZE] SET I = 0
Step 3: Repeat Step 4 while I<N
Step 4: IF A[I] = VAL, then
SET POS = I
PRINT POS
Go to Step 6
[END OF IF]
[END OF LOOP]
Step 5: IF POS = -1
PRINT “Value Not Present In The Array”
[END OF IF]
Step 6: EXIT
© Oxford University Press 2018. All rights reserved.
Binary Search
© Oxford University Press 2018. All rights reserved.
BINARY_SEARCH(A, lower_bound, upper_bound, VAL, POS)
Step 1: [INITIALIZE] SET BEG = lower_bound, END = upper_bound, POS = -1
Step 2: Repeat Step 3 and Step 4 while BEG <= END
Step 3: SET MID = (BEG + END)/2
Step 4: IF A[MID] = VAL, then
POS = MID
PRINT POS
Go to Step 6
ELSE IF A[MID] > VAL then;
SET END = MID - 1
ELSE
SET BEG = MID + 1
[END OF IF]
[END OF LOOP]
Step 5: IF POS = -1, then
PRINTF “VAL IS NOT PRESENT IN THE ARRAY”
[END OF IF]
Step 6: EXIT
Passing Arrays to Functions
1D Arrays For Inter Function Communication
Passing individual elements Passing entire array
Passing data values Passing addresses
Passing data values
main()
{
int arr[5] ={1, 2, 3, 4, 5};
func(arr[3]);
}
void func(int num)
{
printf("%d", num);
}
© Oxford University Press 2018. All rights reserved.
Passing Arrays to Functions
main()
{
int arr[5] ={1, 2, 3, 4, 5};
func(arr);
}
moid func(int arr[5])
{
int i;
for(i=0;i<5;i++)
printf("%d", arr[i]);
}
Passing addresses
main()
{
int arr[5] ={1, 2, 3, 4, 5};
func(&arr[3]);
}
void func(int *num)
{
printf("%d", *num);
}
Passing the entire array
© Oxford University Press 2018. All rights reserved.
Two Dimensional Arrays
• A two dimensional array is specified using two subscripts where one subscript denotes row and
the other denotes column.
• C treats a two dimensional array as an array of one dimensional arrays.
• A two dimensional array is declared as:
data_type array_name[row_size][column_size];
• Therefore, a two dimensional mn array is an array that contains m  n data elements and each
element is accessed using two subscripts, i and j where i<=m and j<=n
int marks[3][5];
Rows/Columns
Col 0 Col 1 Col2 Col 3 Col 4
Row 0 Marks[0][0] Marks[0][1] Marks[0][2] Marks[0][3] Marks[0][4]
Row 1 Marks[1][0] Marks[1][1] Marks[1][2] Marks[1][3] Marks[1][4]
Row 2 Marks[2][0] Marks[2][1] Marks[2][2] Marks[2][3] Marks[2][4]
Two Dimensional Array
© Oxford University Press 2018. All rights reserved.
Memory Representation of a Two Dimensional Array
• There are two ways of storing a 2-D array in memory. The first way is row major order and
the second is column major order.
• In the row major order the elements of the first row are stored before the elements of
the second and third row.
• That is, the elements of the array are stored row by row where n elements of the first row
will occupy the first nth locations.
(0,0) (0, 1) (0,2) (0,3) (1,0) (1,1) (1,2) (1,3) (2,0) (2,1) (2,2) (2,3)
© Oxford University Press 2018. All rights reserved.
Memory Representation of a Two Dimensional Array
(Contd.)
• However, when we store the elements in a column major order, the elements of the first
column are stored before the elements of the second and third column.
• That is, the elements of the array are stored column by column where n elements of the
first column will occupy the first nth locations.
(0,0) (1,0) (2,0) (3,0) (0,1) (1,1) (2,1 (3,1) (0,2) (1,2) (2,2) (3,2)
Address(A[I][J]) = Base_Address + w{M ( J - 1) + (I - 1)}, if the array elements are stored in column major
order
Address(A[I][J]) = Base_Address + w{N ( I - 1) + (J - 1)}, if the array elements are stored in row major
order.
Where w is the number of words stored per memory location
m is the number of columns
n is the number of rows
I and J are the subscripts of the array element
© Oxford University Press 2018. All rights reserved.
Two Dimensional Arrays Contd..
Write a program to print the elements of a 2D array
#include<stdio.h>
#include<conio.h>
main()
{
int arr[2][2] = {12, 34, 56,32};
int i, j;
for(i=0;i<2;i++)
{
printf("n");
for(j=0;j<2;j++)
printf("%dt", arr[i][j]);
}
return 0;
}
© Oxford University Press 2018. All rights reserved.
Passing Two Dimensional Arrays to Functions
Passing individual elements Passing a row
2D Array for Inter Function Communication
Passing the entire 2D array
Passing a row
main()
{
int arr[2][3]= ( {1, 2, 3}, {4, 5, 6} };
func(arr[1]);
}
void func(int arr[])
{
int i;
for(i=0;i<5;i++)
printf("%d", arr[i] * 10);
}
Passing the entire 2D array
To pass a two dimensional array to a function, we use the array name as the actual parameter. (The
same we did in case of a 1D array). However, the parameter in the called function must indicate that the
array has two dimensions.
© Oxford University Press 2018. All rights reserved.
Program Illustrating Passing Entire Array to a
Function
#include<stdio.h>
void read_matrix(int mat[][], int, int);
void sum_matrix(int mat1[][], int mat2[][], int, int);
void display_matrix(int mat[5][5], int r, int c);
int main()
{ int row, col, mat1[5][5], mat2[5][5];
printf(“n Enter the number of rows and columns of the matrix : ”);
scanf(“%d %d”, &row, &col);
read_matrix(mat1, row, col);
printf(“n Enter the second matrix : “);
read_matrix(mat2, row, col);
sum_matrix(mat1, mat2, row, col);
}
void read_matrix(int mat[5][5], int r, int c)
{ int i, j;
for(i=0;i<r;i++)
{ for(j=0;j<c;j++)
{ printf(“n mat[%d][%d] = ”);
scanf(“%d“, &mat[i][j]);
}
}
}
void sum_matrix(int mat1[5][5], mat2[5][5], int r, int c)
{ int i, j, sum[5][5];
for(i=0;i<r;i++)
{ for(j=0;j<c;j++)
sum[i][j] = mat1[i][j] + mat2[i][j];
}
display_matrix(sum, r, c);
}
void display_matrix(int mat[5][5], int r, int c)
{ int i, j;
for(i=0;i<r;i++)
{ printf(“n”);
for(j=0;j<c;j++)
printf(“t mat[%d][%d] = %d“, mat[i][j]);
}
}
© Oxford University Press 2018. All rights reserved.
Multi Dimensional Arrays
• A multi dimensional array is an array of arrays.
• Like we have one index in a single dimensional array, two indices in a two dimensional array, in the same way we have n
indices in an n-dimensional array or multi dimensional array.
• Conversely, an n dimensional array is specified using n indices.
• An n dimensional m1 x m2 x m3 x ….. mn array is a collection m1*m2*m3* ….. *mn elements.
• In a multi dimensional array, a particular element is specified by using n subscripts as A[I1][I2][I3]…[In], where,
I1<=M1 I2<=M2 I3 <= M3 ……… In <= Mn
© Oxford University Press 2018. All rights reserved.
Program to Read and Display a 2x2x2 Array
#include<stdio.h>
int main()
{ int array1[3][3][3], i, j, k;
printf(“n Enter the elements of the matrix”);
printf(“n ******************************”);
for(i=0;i<2;i++)
{ for(j=0;j<2;j++)
{
for(k=0;k<2;k++)
{
printf(“n array[%d][ %d][ %d] = ”, i, j, k);
scanf(“%d”, &array1[i][j][k]);
}
}
}
printf(“n The matrix is : “);
printf(“n *********************************”)l
for(i=0;i<2;i++)
{ printf(“nn”);
for(j=0;j<2;j++)
{
printf(“n”);
for(k=0;k<2;k++)
printf(“t array[%d][ %d][ %d] = %d”, i, j, k, array1[i][j][k]);
}
}
}
© Oxford University Press 2018. All rights reserved.

UNIT 1 - ARRAYS AAAAAAAAAAAAAAAAAAAAAAAAA

  • 1.
    Reema Thareja Programming inC © Oxford University Press 2018. All rights reserved.
  • 2.
    CHAPTER 5 Arrays © OxfordUniversity Press 2018. All rights reserved.
  • 3.
    Introduction • An arrayis a collection of similar data elements. • These data elements have the same data type. • The elements of the array are stored in consecutive memory locations and are referenced by an index (also known as the subscript). • Declaring an array means specifying three things:  Data type - what kind of values it can store. For example, int, char, float  Name - to identify the array  Size- the maximum number of values that the array can hold • Arrays are declared using the following syntax. type name[size]; 1st element 2nd element 3rd element 4th element 5th element 6th element 7th element 8th element 9th element 10th element marks[0] marks[1] marks[2] marks[3] marks[4] marks[5] marks[6] marks[7] marks[8] marks[9] © Oxford University Press 2018. All rights reserved.
  • 4.
    Accessing Elements ofan Array • To access all the elements of the array, you must use a loop. That is, we can access all the elements of the array by varying the value of the subscript into the array. • But note that the subscript must be an integral value or an expression that evaluates to an integral value. int i, marks[10]; for(i=0;i<10;i++) marks[i] = -1; © Oxford University Press 2018. All rights reserved.
  • 5.
    Calculating the Addressof Array Elements Address of data element, A[k] = BA(A) + w( k – lower_bound) Here A is the array k is the index of the element of which we have to calculate the address BA is the base address of the array A w is the word size of one element in memory, for example, size of int is 2 Address(Marks[4]) = 1000 + 2(4 – 0) = 1000 + 2(4) = 1008 99 67 78 56 88 90 34 85 Marks[0] marks[1] marks[2] marks[3] marks[4] marks[5] marks[6] marks[7] marks[7] 1000 1002 1004 1006 1008 1010 1012 1014 © Oxford University Press 2018. All rights reserved.
  • 6.
    Calculating the Lengthof an Array Length = upper_bound – lower_bound + 1 Where upper_bound is the index of the last element and lower_bound is the index of the first element in the array 99 67 78 56 88 90 34 85 Marks[0] marks[1] marks[2] marks[3] marks[4] marks[5] marks[6 marks[7]] Here, lower_bound = 0, upper_bound = 7 Therefore, length = 7 – 0 + 1 = 8 © Oxford University Press 2018. All rights reserved.
  • 7.
    Storing Vales inArrays Store values in the array Initialize the elements Input values for the elements Assign values to the elements Initialization of Arrays Arrays are initialized by writing, type array_name[size]={list of values}; int marks[5]={90, 82, 78, 95, 88}; int i, marks[10]; for(i=0;i<10;i++) scanf(“%d”, &marks[i]); Assigning Values int i, arr1[10], arr2[10]; for(i=0;i<10;i++) arr2[i] = arr1[i]; Inputting Values © Oxford University Press 2018. All rights reserved.
  • 8.
    Write a Programto Read and Display N Numbers Using an Array #include<stdio.h> #include<conio.h> int main() { int i=0, n, arr[20]; clrscr(); printf(“n Enter the number of elements : ”); scanf(“%d”, &n); for(i=0;i<n;i++) { printf(“n Arr[%d] = ”, i); scanf(“%d”,&arr[i]); } printf(“n The array elements are ”); for(i=0;i<n;i++) printf(“Arr[%d] = %dt”, i, arr[i]); return 0; } © Oxford University Press 2018. All rights reserved.
  • 9.
    Inserting an Elementin the Array Algorithm to insert a new element to the end of the array. Step 1: Set upper_bound = upper_bound + 1 Step 2: Set A[upper_bound] = VAL Step 3: EXIT The algorithm INSERT will be declared as INSERT( A, N, POS, VAL). Step 1: [INITIALIZATION] SET I = N Step 2: Repeat Steps 3 and 4 while I >= POS Step 3: SET A[I + 1] = A[I] Step 4: SET I = I – 1 [End of Loop] Step 5: SET N = N + 1 Step 6: SET A[POS] = VAL Step 7: EXIT © Oxford University Press 2018. All rights reserved.
  • 10.
    Deleting an ElementFrom the Array Algorithm to delete an element from the end of the array Step 1: Set upper_bound = upper_bound - 1 Step 2: EXIT Step 1: [INITIALIZATION] SET I = POS Step 2: Repeat Steps 3 and 4 while I <= N - 1 Step 3: SET A[I] = A[I + 1] Step 4: SET I = I + 1 [End of Loop] Step 5: SET N = N - 1 Step 6: EXIT The algorithm DELETE will be declared as DELETE( A, N, POS). © Oxford University Press 2018. All rights reserved.
  • 11.
    Linear Search LINEAR_SEARCH(A, N,VAL, POS) Step 1: [INITIALIZE] SET POS = -1 Step 2: [INITIALIZE] SET I = 0 Step 3: Repeat Step 4 while I<N Step 4: IF A[I] = VAL, then SET POS = I PRINT POS Go to Step 6 [END OF IF] [END OF LOOP] Step 5: IF POS = -1 PRINT “Value Not Present In The Array” [END OF IF] Step 6: EXIT © Oxford University Press 2018. All rights reserved.
  • 12.
    Binary Search © OxfordUniversity Press 2018. All rights reserved. BINARY_SEARCH(A, lower_bound, upper_bound, VAL, POS) Step 1: [INITIALIZE] SET BEG = lower_bound, END = upper_bound, POS = -1 Step 2: Repeat Step 3 and Step 4 while BEG <= END Step 3: SET MID = (BEG + END)/2 Step 4: IF A[MID] = VAL, then POS = MID PRINT POS Go to Step 6 ELSE IF A[MID] > VAL then; SET END = MID - 1 ELSE SET BEG = MID + 1 [END OF IF] [END OF LOOP] Step 5: IF POS = -1, then PRINTF “VAL IS NOT PRESENT IN THE ARRAY” [END OF IF] Step 6: EXIT
  • 13.
    Passing Arrays toFunctions 1D Arrays For Inter Function Communication Passing individual elements Passing entire array Passing data values Passing addresses Passing data values main() { int arr[5] ={1, 2, 3, 4, 5}; func(arr[3]); } void func(int num) { printf("%d", num); } © Oxford University Press 2018. All rights reserved.
  • 14.
    Passing Arrays toFunctions main() { int arr[5] ={1, 2, 3, 4, 5}; func(arr); } moid func(int arr[5]) { int i; for(i=0;i<5;i++) printf("%d", arr[i]); } Passing addresses main() { int arr[5] ={1, 2, 3, 4, 5}; func(&arr[3]); } void func(int *num) { printf("%d", *num); } Passing the entire array © Oxford University Press 2018. All rights reserved.
  • 15.
    Two Dimensional Arrays •A two dimensional array is specified using two subscripts where one subscript denotes row and the other denotes column. • C treats a two dimensional array as an array of one dimensional arrays. • A two dimensional array is declared as: data_type array_name[row_size][column_size]; • Therefore, a two dimensional mn array is an array that contains m  n data elements and each element is accessed using two subscripts, i and j where i<=m and j<=n int marks[3][5]; Rows/Columns Col 0 Col 1 Col2 Col 3 Col 4 Row 0 Marks[0][0] Marks[0][1] Marks[0][2] Marks[0][3] Marks[0][4] Row 1 Marks[1][0] Marks[1][1] Marks[1][2] Marks[1][3] Marks[1][4] Row 2 Marks[2][0] Marks[2][1] Marks[2][2] Marks[2][3] Marks[2][4] Two Dimensional Array © Oxford University Press 2018. All rights reserved.
  • 16.
    Memory Representation ofa Two Dimensional Array • There are two ways of storing a 2-D array in memory. The first way is row major order and the second is column major order. • In the row major order the elements of the first row are stored before the elements of the second and third row. • That is, the elements of the array are stored row by row where n elements of the first row will occupy the first nth locations. (0,0) (0, 1) (0,2) (0,3) (1,0) (1,1) (1,2) (1,3) (2,0) (2,1) (2,2) (2,3) © Oxford University Press 2018. All rights reserved.
  • 17.
    Memory Representation ofa Two Dimensional Array (Contd.) • However, when we store the elements in a column major order, the elements of the first column are stored before the elements of the second and third column. • That is, the elements of the array are stored column by column where n elements of the first column will occupy the first nth locations. (0,0) (1,0) (2,0) (3,0) (0,1) (1,1) (2,1 (3,1) (0,2) (1,2) (2,2) (3,2) Address(A[I][J]) = Base_Address + w{M ( J - 1) + (I - 1)}, if the array elements are stored in column major order Address(A[I][J]) = Base_Address + w{N ( I - 1) + (J - 1)}, if the array elements are stored in row major order. Where w is the number of words stored per memory location m is the number of columns n is the number of rows I and J are the subscripts of the array element © Oxford University Press 2018. All rights reserved.
  • 18.
    Two Dimensional ArraysContd.. Write a program to print the elements of a 2D array #include<stdio.h> #include<conio.h> main() { int arr[2][2] = {12, 34, 56,32}; int i, j; for(i=0;i<2;i++) { printf("n"); for(j=0;j<2;j++) printf("%dt", arr[i][j]); } return 0; } © Oxford University Press 2018. All rights reserved.
  • 19.
    Passing Two DimensionalArrays to Functions Passing individual elements Passing a row 2D Array for Inter Function Communication Passing the entire 2D array Passing a row main() { int arr[2][3]= ( {1, 2, 3}, {4, 5, 6} }; func(arr[1]); } void func(int arr[]) { int i; for(i=0;i<5;i++) printf("%d", arr[i] * 10); } Passing the entire 2D array To pass a two dimensional array to a function, we use the array name as the actual parameter. (The same we did in case of a 1D array). However, the parameter in the called function must indicate that the array has two dimensions. © Oxford University Press 2018. All rights reserved.
  • 20.
    Program Illustrating PassingEntire Array to a Function #include<stdio.h> void read_matrix(int mat[][], int, int); void sum_matrix(int mat1[][], int mat2[][], int, int); void display_matrix(int mat[5][5], int r, int c); int main() { int row, col, mat1[5][5], mat2[5][5]; printf(“n Enter the number of rows and columns of the matrix : ”); scanf(“%d %d”, &row, &col); read_matrix(mat1, row, col); printf(“n Enter the second matrix : “); read_matrix(mat2, row, col); sum_matrix(mat1, mat2, row, col); } void read_matrix(int mat[5][5], int r, int c) { int i, j; for(i=0;i<r;i++) { for(j=0;j<c;j++) { printf(“n mat[%d][%d] = ”); scanf(“%d“, &mat[i][j]); } } } void sum_matrix(int mat1[5][5], mat2[5][5], int r, int c) { int i, j, sum[5][5]; for(i=0;i<r;i++) { for(j=0;j<c;j++) sum[i][j] = mat1[i][j] + mat2[i][j]; } display_matrix(sum, r, c); } void display_matrix(int mat[5][5], int r, int c) { int i, j; for(i=0;i<r;i++) { printf(“n”); for(j=0;j<c;j++) printf(“t mat[%d][%d] = %d“, mat[i][j]); } } © Oxford University Press 2018. All rights reserved.
  • 21.
    Multi Dimensional Arrays •A multi dimensional array is an array of arrays. • Like we have one index in a single dimensional array, two indices in a two dimensional array, in the same way we have n indices in an n-dimensional array or multi dimensional array. • Conversely, an n dimensional array is specified using n indices. • An n dimensional m1 x m2 x m3 x ….. mn array is a collection m1*m2*m3* ….. *mn elements. • In a multi dimensional array, a particular element is specified by using n subscripts as A[I1][I2][I3]…[In], where, I1<=M1 I2<=M2 I3 <= M3 ……… In <= Mn © Oxford University Press 2018. All rights reserved.
  • 22.
    Program to Readand Display a 2x2x2 Array #include<stdio.h> int main() { int array1[3][3][3], i, j, k; printf(“n Enter the elements of the matrix”); printf(“n ******************************”); for(i=0;i<2;i++) { for(j=0;j<2;j++) { for(k=0;k<2;k++) { printf(“n array[%d][ %d][ %d] = ”, i, j, k); scanf(“%d”, &array1[i][j][k]); } } } printf(“n The matrix is : “); printf(“n *********************************”)l for(i=0;i<2;i++) { printf(“nn”); for(j=0;j<2;j++) { printf(“n”); for(k=0;k<2;k++) printf(“t array[%d][ %d][ %d] = %d”, i, j, k, array1[i][j][k]); } } } © Oxford University Press 2018. All rights reserved.