May 3, 2010 at 6:13pm UTC
// Copyright (C) Tony 2010 <tonytran@charter.net>
#include <iostream>
int main()
{
// what is the output of the c++ code?
int x;
int y;
int *p = &x;
int *q = &y;
x = 35;
y = 46; p = q;
*p = 78
cout << x << " " << y << endl;
cout << *p << " " << *q << endl;
return 0;
}
May 3, 2010 at 6:25pm UTC
Please use [co de][/co de] tags
If the question is "What is the output of the code I posted? "
The answer is "Compile it and run it to find out "
May 3, 2010 at 6:54pm UTC
I have tried that and compiler sent out error message
May 3, 2010 at 6:59pm UTC
You forgot a semicolon:
*p=78;
May 3, 2010 at 7:09pm UTC
y = 46; p = q;
should be a comma. y=46, p=q;
May 4, 2010 at 1:45am UTC
Ooops sorry about that, I didn't saw that's already been declared. (3:09 AM since my last post)