Consider the following decleration: Int beta [3][3]; What is stored in beta afte
ID: 643798 • Letter: C
Question
Consider the following decleration:
Int beta [3][3];
What is stored in beta after each of the following statements executes?
a. for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
beta [i][j] = 0;
b. for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
beta [i][j] = i + j;
c. for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
beta [i][j] = i * j;
d. for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
beta [i][j] = 2 * (i + j) % 4;
Explanation / Answer
1)
{0,0,0,0,0,0,0,0,0};
2)
{0,1,2,1,2,3,2,3,4}
3)
{0,0,0,0,1,2,0,2,4}
4)
{0,2,0,2,0,2,0,2,0}