#include <iostream>
using namespace std;
void swap(int, int);
int main()
{
    int a=10;
    int b=20;
    swap (a, b);
    cout << "a: " << a << endl;
    cout << "b: " << b << endl;
    return 0;
}
void swap(int x, int y)
{
    int t;
    t = x;
    x = y;
    y = t;
}
those code above can't swap the value of a and b. but my question is , when I forgot to type the third line "void swap(int, int); " , the values of a and b swaped !! why?
 
     
     
     
    