πŸ“Š C++
Q. Which of the following will correctly initialize a dynamic array of integers with 10 elements?
  • (A) int* arr = new int[10];
  • (B) int arr[10] = new[];
  • (C) int* arr = malloc(10 * sizeof(int));
  • (D) int arr[10] = new int[10];
πŸ’¬ Discuss
βœ… Correct Answer: (A) int* arr = new int[10];

Explanation: In C++, the correct way to initialize a dynamic array is using the 'new' operator like 'int* arr = new int[10];'.

Explanation by: Rakesh Kumar
In C++, the correct way to initialize a dynamic array is using the 'new' operator like 'int* arr = new int[10];'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
155
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Rakesh Kumar
Publisher
πŸ“ˆ
97%
Success Rate