Answer to Question #280425 in C++ for A lawal

Question #280425

What is the output of this program (if any)


#include<iostream.h>


using namespace std; 


void main() 

{

int num=123;

int *p_num;

cout<<"if any"<<"\n";

cout<<num<<"\n";

cout<<&num<<"\n";

cout<<*p_num<<"\n";

cout<<p_num<<"\n";

}


1
Expert's answer
2021-12-20T09:57:44-0500

The line "cout<<*p_num" gives an error, because variable p_num need initialization before using cout. The line "cout<<p_num<<"\n"" may work on some compilators and prints "0", but with Microsoft Visual Studio you will get an error on compilation with the message about initialization variable p_num.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog