Multiple choice technology programming languages

What is the output of the following? int main() { ... int *p=new int(87); ... }

  1. compile time error

  2. run time error

  3. p is initialized to 87

  4. space for an array of 87 integers is allocated

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In C++, new int(87) allocates memory for a single int and initializes it to 87. The pointer p points to this allocated int containing value 87. Option D would require new int[87](array syntax).