Assume that ip has been declared to be a pointer to int and that result has been declared to be an array of 100 elements. Assume further that ip has been initialized to point to an element in the first half of the array. Write a statement that makes ip point to the next element in the array.

C++

LANGUAGE: C++ CHALLENGE: Assume that ip has been declared to be a pointer to int and that result has been declared to be an array of 100 elements. Assume further that ip has been initialized to point to an element in the first half of the array. Write a statement that makes ip point to…

Read More

Assume that ip has been declared to be a pointer to int and that result has been declared to be an array of 100 elements . Assume further that ip has been initialized to point to an element in the first half of the array. Write an expression whose value is the element in the array after the element that ip points to.

C++

LANGUAGE: C++ CHALLENGE: Assume that ip has been declared to be a pointer to int and that result has been declared to be an array of 100 elements . Assume further that ip has been initialized to point to an element in the first half of the array. Write an expression whose value is the…

Read More

Write an expression that evaluates to 1 more than the value in the location pointed to by the integer pointer variable ip. Thus, if ip points to a location containing the value 3, the expression should evaluate to 4.

C++

LANGUAGE: C++ CHALLENGE: Write an expression that evaluates to 1 more than the value in the location pointed to by the integer pointer variable ip. Thus, if ip points to a location containing the value 3, the expression should evaluate to 4.

Read More

Assume that ip has been declared to be a pointer to int and that enrollment has been declared to be an array of 20 elements. Assume also that section has been declared to be an int and has been initialized to some value between 5 and 10. Write a statement that makes ip point to the element in the array indexed by section.

C++

LANGUAGE: C++ CHALLENGE: Assume that ip has been declared to be a pointer to int and that enrollment has been declared to be an array of 20 elements. Assume also that section has been declared to be an int and has been initialized to some value between 5 and 10. Write a statement that makes…

Read More

Assume that ip and jp have both been declared to be pointers to int and that result has been declared to be an array of 100 elements. Assume further that ip has been initialized to point to an element in the first half of the array. Write a statement that makes jp point to the element in the array 5 positions after the one that ip points to.

C++

LANGUAGE: C++ CHALLENGE: Assume that ip and jp have both been declared to be pointers to int and that result has been declared to be an array of 100 elements. Assume further that ip has been initialized to point to an element in the first half of the array. Write a statement that makes jp…

Read More

divide is a function that takes four arguments and returns no value. The first two arguments are of type int. The last two arguments arguments are pointers to int that are set by the function to the quotient and remainder of dividing the first argument by the second argument. The function does not return a value. x and y are two int variables that have been declared and initialized. q and r are two int variables that have been declared. Write a statement that sets the value of q to the quotient of x divided by y , and sets the value of r to the remainder of x divided by y, by calling divide.

C++

LANGUAGE: C++ CHALLENGE: divide is a function that takes four arguments and returns no value. The first two arguments are of type int. The last two arguments arguments are pointers to int that are set by the function to the quotient and remainder of dividing the first argument by the second argument. The function does…

Read More

tripleIt is a function that takes one argument and returns no value. The argument is a pointer to int. The function triples the value that the argument points to and stores it back. penalty is an int variable that has been declared and initialized. Write a statement that triples the value stored in penalty by invoking the function tripleIt. For example, if the value in penalty was 7 before your statement, after your statement its value would be 2.

C++

LANGUAGE: C++ CHALLENGE: tripleIt is a function that takes one argument and returns no value. The argument is a pointer to int. The function triples the value that the argument points to and stores it back. penalty is an int variable that has been declared and initialized. Write a statement that triples the value stored…

Read More

doubleIt is a function that takes one argument and returns no value. The argument is a pointer to int. The function doubles the value that the argument points to and stores it back. savings is an int variable that has been declared and initialized. Write a statement that doubles the value stored in savings by invoking the function doubleIt. For example, if the value in savings was 7 before your statement, after your statement its value would be 14.

C++

LANGUAGE: C++ CHALLENGE: doubleIt is a function that takes one argument and returns no value. The argument is a pointer to int. The function doubles the value that the argument points to and stores it back. savings is an int variable that has been declared and initialized. Write a statement that doubles the value stored…

Read More

zeroIt is a function that takes one argument and returns no value. The argument is a pointer to int. The function stores the value 0 back into the variable pointed to by the argument. x is an int variable that has been declared. Write a statement that sets the value stored in x to zero by invoking the function zeroIt.

C++

LANGUAGE: C++ CHALLENGE: zeroIt is a function that takes one argument and returns no value. The argument is a pointer to int. The function stores the value 0 back into the variable pointed to by the argument. x is an int variable that has been declared. Write a statement that sets the value stored in…

Read More