State whether the following are true or false. If the answer is false, explain why.
1) The address operator & can be applied only to constants and to expressions.
2) A pointer that is declared to be of type void * can be dereferenced.
3) Pointers of different types can’t be assigned to one another without a cast operation.
4) All arguments to function calls in C++ are passed by value.
1) False. The operand of the address operator must be an lvalue; the address operator cannot be applied to constants or to expressions that do not result in references.
2) False. A pointer to void cannot be dereferenced. Such a pointer does not have a type that enables the compiler to determine the number of bytes of memory to dereferenced and the type of the data to which the pointer points.
3) False. Pointers of any type can be assigned to void pointers. Pointers of type void can be assigned to pointers of other types only with an explicit type cast.
4) False. C++ enables pass-by-reference using reference parameters (and pointers, as we discuss in Chapter 7).
You might also like to view...
Emergency 911 calls always go to
a. the police dispatch office. b. the telephone company. c. the public safety answering point. d. the city switchboard.
The correlation name is also known as a(n) ___________.
a. alias b. alternative c. substitute d. pseudo name