Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
int arr[] = {4, 5, 6, 7};
int *p = (arr + 1);
cout << arr;
return 0;
}

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
int arr[] = {4, 5, 6, 7};
int *p = (arr + 1);
cout << arr;
return 0;
}
a) 4
b) 5
c) address of arr
d) 7

Answer: c
Explanation: As we counted to print only arr, it will print the address of the array.
Output:
0xbfb1cf

Join The Discussion