For each of the following, write C++ statements that perform the specified task. Assume that double-precision, floating-point numbers are stored in eight bytes and that the starting address of the array is at location 1002500 in memory. Each part of the exercise should use the results of previous parts where appropriate.
Declare an array of type double called numbers with 10 elements, and initialize the elements to the values 0.0, 1.1, 2.2, ..., 9.9. Assume that the symbolic constant SIZE has been defined as 10.
Declare a pointer nPtr that points to a variable of type double.
Use a for statement to print the elements of array numbers using array subscript notation. Print each number with one position of precision to the right of the decimal point.
Write two separate statements that each assign the starting address of array numbers to the pointer variable nPtr.
Use a for statement to print the elements of array numbers using pointer/offset notation with pointer nPtr.
Use a for statement to print the elements of array numbers using pointer/offset notation with the array name as the pointer.
Use a for statement to print the elements of array numbers using pointer/subscript notation with pointer nPtr.
Refer to the fourth element of array numbers using array subscript notation, pointer/offset notation with the array name as the pointer, pointer subscript notation with nPtr and pointer/offset notation with nPtr.
Assuming that nPtr points to the beginning of array numbers, what address is referenced by nPtr + 8? What value is stored at that location?
Assuming that nPtr points to numbers[ 5 ], what address is referenced by nPtr after nPtr -= 4 is executed? What is the value stored at that location?
For each of the following, write a single statement that performs the specified task. Assume that floating-point variables number1 and number2 have been declared and that number1 has been initialized to 7.3. Assume that variable ptr is of type char *. Assume that arrays s1 and s2 are each 100-element char arrays that are initialized with string literals.
Declare the variable fPtr to be a pointer to an object of type double.
Assign the address of variable number1 to pointer variable fPtr.
Print the value of the object pointed to by fPtr.
Assign the value of the object pointed to by fPtr to variable number2.
Print the value of number2.
Print the address of number1.
Print the address stored in fPtr. Is the value printed the same as the address of number1?
Copy the string stored in array s2 into array s1.
Compare the string in s1 with the string in s2, and print the result.
Append the first 10 characters from the string in s2 to the string in s1.
Determine the length of the string in s1, and print the result.
Assign to ptr the location of the first token in s2. The tokens delimiters are commas (,).
Perform the task specified by each of the following statements:
Write the function header for a function called exchange that takes two pointers to double-precision, floating-point numbers x and y as parameters and does not return a value.
Write the function prototype for the function in part (a).
Write the function header for a function called evaluate that returns an integer and that takes as parameters integer x and a pointer to function poly. Function poly takes an integer parameter and returns an integer.
Write the function prototype for the function in part (c).
Write two statements that each initialize character array vowel with the string of vowels, "AEIOU".
What (if anything) prints when each of the following statements is performed? If the statement contains an error, describe the error and indicate how to correct it. Assume the following variable declarations: