Q. Which of the following is the correct way to allocate memory dynamically for an integer in C++?

  • (A) new int;
  • (B) malloc(int);
  • (C) allocate int;
  • (D) int new();
πŸ’¬ Discuss
βœ… Correct Answer: (A) new int;
Explanation: In C++, the 'new' operator is used to allocate memory dynamically. The correct syntax is 'new int;'.
Explanation by: Praveen Singh
In C++, the 'new' operator is used to allocate memory dynamically. The correct syntax is 'new int;'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
228
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Praveen Singh
Publisher
πŸ“ˆ
84%
Success Rate