Check my answer please

Dec 17, 2015 at 8:08pm
int x = 7;
int *ptr = &x;

a.) What will be displayed if you send the expression *iptr to cout?

7 will be displayed

b.) What happens if you send the expression ptr to cout?

Display address of x

Are these right?
Last edited on Dec 17, 2015 at 8:08pm
Dec 17, 2015 at 8:19pm
There are these interesting things called compilers. You can put your code in a file, invoke the compiler on the source files, and run the resulting executable. In that way, you can check what simple code does for yourself.

There are even online versions of these compilers, so if you've internet access that lets you post here, you can probably use an online compiler!
Dec 17, 2015 at 8:21pm
Ya I know, but I my visual studio loads slow okay. If it's simple can't you just say if it's right or wrong instead of writing a paragraph..
Last edited on Dec 17, 2015 at 8:23pm
Dec 17, 2015 at 8:40pm
I'm getting error when I run anyway.
Dec 18, 2015 at 12:22am
So I did run it and your answer is correct. Just a heads up, but a program like http://www.tutorialspoint.com/compile_cpp11_online.php can be useful if you don't want to run it on your computer as it is slow.

Also, there is a typo and it should be *ptr instead of *iptr.
Last edited on Dec 18, 2015 at 12:23am
Topic archived. No new replies allowed.