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 x[100];
int main()
{
cout << x[99] << endl;
}

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int x[100];
int main()
{
cout << x[99] << endl;
}
a) Garbage value
b) 0
c) 99
d) Error

Answer: b
Explanation: In C++ all the uninitialized variables are set to 0 therefore the value of all elements of the array is set to 0.

Join The Discussion