Q. Which of the following statements is/are valid for dynamically allocating memory for an integer in C++?

  • (A) int *ptr = new int(100);
  • (B) int *ptr; ptr=new int; *ptr=100;
  • (C) int *ptr=NULL; ptr=new int; *ptr=100;
  • (D) All the answers are true
πŸ’¬ Discuss
βœ… Correct Answer: (D) All the answers are true

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
261
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Dharmendra Sir
Publisher
πŸ“ˆ
80%
Success Rate