πŸ“Š C++
Q. What is the output of the following C++ code?
Code:
#include <iostream>
using namespace std;
int main()
{
  int arr[] = {1, 2, 3, 4, 5};
  int *ptr = (arr + 1);
  cout << *arr + 2;
  return 0;
}
  • (A) 1
  • (B) 2
  • (C) 3
  • (D) 4
πŸ’¬ Discuss
βœ… Correct Answer: (C) 3

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
185
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
96%
Success Rate