Multiple choice technology programming languages

C++

  1. char *a=new char[20];

  2. char a=new char[20];

  3. char a=new char(20.0);

  4. None of the Above

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

The syntax char *a = new char[20]; is the correct way to dynamically allocate an array of 20 characters. Option B is incorrect because 'char a' declares a single char, not a pointer. Option C is incorrect because it uses parentheses (20.0) instead of brackets [20] for array allocation.