128k views
0 votes
What is the output of the following code fragment? float "pl pl= new float(3) cout << *pl; a. unknown, the address p1 points to is not initialized b. 0.0 c. 3.0 d. unknown, the code is illegal, p1 points to a dynamic array

1 Answer

3 votes

Answer:

c. 3.0

Step-by-step explanation:

The code initializes a pointer to a dynamically allocated float with the value of 3.0. The pointer is then dereferenced using the * operator in the cout statement, which outputs the value stored in the memory location pointed to by the pointer, in this case, the float with the value of 3.0.

User SiN
by
6.9k points