//The following code works and there is no way it should. Seems like a bug
someone put in on purpose
#include <iostream>
using namespace std;
void swap(int *x, int *y)
{
int temp;
temp = *x;
*x = *y;
*y = temp;
}
int main()
{
int x = 10;
int y = 20;
cout << x << " " << y << endl;
swap(x,y); //how does this work, there is no way this should compile
and
run and actually work
cout << x << " " << y << endl;
}
--
View this message in context:
http://www.nabble.com/Pass-by-reference-problem-tp22049211p22049211.html
Sent from the gcc - bugs mailing list archive at Nabble.com.