#define ALLOW_INSTRUCTOR_CODE /*************************************************************************** *************************************************************************** ****** BEFORE BEGINNING OR TURNING IN THIS EXERCISE IT IS EXTREMELY ****** ****** IMPORTANT THAT YOU READ, FULLY UNDERSTAND, AND ADHERE TO THE ****** ****** REQUIREMENTS STATED IN THE DOCUMENT TITLED, "ASSIGNMENT ****** ****** SUBMISSION REQUIREMENTS", DOWNLOADABLE FROM THE COURSE WEB ****** ****** SITE. ****** *************************************************************************** **************************************************************************/ /*************************************************************************** ************* C/C++ Programming 2: Assignment 3 - Exercise 2 ************* ******** BEGIN EXERCISE REQUIREMENT - THIS MUST BE A "C++" PROGRAM ******** *************************************************************************** (2 points) The following sentences describe declarations and a type cast, all of which can be implemented as syntactly-legal code: A. "v is a pointer to void." B. "a is a function returning an int and having one int parameter named y." C. "z is a pointer to a pointer to an array of 3 floats." D. "x is a reference to a pointer to a pointer to an array of 3 floats." (legal in C++ only) E. "type cast to a pointer to a pointer to an array of 3 floats" For example, a sentence that reads, "x is an int", gets coded as int x; and a sentence that reads, "type cast to a pointer to a double" becomes (double *) and can be used on the variable x with the syntax (double *)x. Write function TestDeclarations: TestDeclarations syntax: void TestDeclarations(); Parameters: none Synopsis: * Contains only the 5 syntactly-correct declarations and typecast for sentences A-E above. * The type cast created for sentence E must be used on variable from sentence A. Return: void * Place a comment by each declaration/typecast indicating the letter of the sentence it represents. * Compiler "unreferenced" symbol/variable warnings are okay for this exercise only. * If sentence B causes a compiler error when placed inside the function, place it on the line just before the function instead. * Initialize the variable declared in sentence D to the variable declared in sentence C. *************************************************************************** ************************ END EXERCISE REQUIREMENT ************************* **************************************************************************/ /*************************************************************************** * BEFORE PRINTING THIS ASSIGNMENT TO TURN IN, DELETE THIS COMMENT AND * EVERYTHING ABOVE IT. **************************************************************************/ /* * TODO: * REPLACE THIS COMMENT WITH YOUR TITLE BLOCK. */ /* * TODO: * REPLACE THIS COMMENT WITH YOUR C++ CODE, PLUS ANYTHING NECESSARY TO * SUPPORT MY TEST CODE BELOW. DO NOT INCLUDE ANY UNNEEDED HEADER FILES! */ /*************************************************************************** * BEFORE PRINTING THIS ASSIGNMENT TO TURN IN, DELETE THIS COMMENT AND * EVERYTHING BELOW IT. **************************************************************************/ /* ***** Change nothing below this comment without instructor permission. **** * Everything that follows was written to help test/verify your code. You * do not need to understand the details of my code to write yours! */ #ifdef ALLOW_INSTRUCTOR_CODE int main() { TestDeclarations(); cout << "Done!\n"; return EXIT_SUCCESS; } #endif