In C, For each of the following, write a single statement that carries out the i
ID: 642296 • Letter: I
Question
In C,
For each of the following, write a single statement that carries out the indicated operation
Define an array named myVals that stores 10 items of type int.
Assign the value stored at index 8 of array myVals to a variable x.
Assign the value 555 to the element at index 2 of array myVals.
Assign the value 777 to the second element of array myVals.
Declare an array of ints named myVals with 4 elements each initialized to 10. Remember, your answer must be a single statement.
Declare a 2-dimensional array with 2 rows and 3 columns with inialization so that it represents the following matrix
5 4 1 3 -1 4Explanation / Answer
Define an array named myVals that stores 10 items of type int.
int myVals[10];
Assign the value stored at index 8 of array myVals to a variable x.
x = myVals[8];
Assign the value 555 to the element at index 2 of array myVals.
myVals[2] = 555;
Assign the value 777 to the second element of array myVals.
myVals[1] = 777;
Declare an array of ints named myVals with 4 elements each initialized to 10. Remember, your answer must be a single statement.
int myVals[4] = {10,10,10,10};
Declare a 2-dimensional array with 2 rows and 3 columns with inialization so that it represents the following matrix
int array[2][3] = { {5, 4, 1},{3, -1, 4}};