a) Complete the following void function named ExchangeValues to exchangetwo integers by filling in the blanks and adding the required statements . After the exchange, val1 will have the value that was in val2, and val2 will have the value that was in val1. Write the complete function. Do not display the values. void ExchangeValues( val1, val2) { . statements here } b) Consider the following code segment: int myNumbers[8] = {3, 1, 5, 4, 7, 2, 12, 10}; Write the statement that will call the function written in (a) above, to exchange the values stored in the first element and the second element of the array myNumbers.
a) Complete the following void function named ExchangeValues to exchangetwo integers by filling in the blanks and adding the required statements . After the exchange, val1 will have the value that was in val2, and val2 will have the value that was in val1. Write the complete function. Do not display the values.
void ExchangeValues( val1, val2)
{
. statements here
}
b) Consider the following code segment:
int myNumbers[8] = {3, 1, 5, 4, 7, 2, 12, 10};
Write the statement that will call the function written in (a) above, to exchange the values stored in the first element and the second element of the array myNumbers.
Step by step
Solved in 2 steps