Exam4Training

What will happen when you attempt to compile and run the following code?

What will happen when you attempt to compile and run the following code?

#include <iostream>

using namespace std;

int getValue();

int main()

{

const int x = getValue();

cout<<x;

return 0;

}

int getValue()

{

return 5;

}
A . It will print 0
B.The code will not compile.
C.It will print 5
D.It will print garbage value

Answer: C

Exit mobile version