i was trying to do number swap..but in vain..
#include<iostream>
using namespace std;
function change(int *a , int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int a=1, b=10;
int main()
{
cout << "a is "<<a<<" and b is "<<b<<endl;
change(&a, &b);
cout << "a becomes "<<a<<" and b becomes "<<b<<endl;
}
---------------
6 `function' does not name a type
20 `change' undeclared (first use this function)
---------------
i've no ideas... plz give some comments. great thx.
#include<iostream>
using namespace std;
function change(int *a , int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int a=1, b=10;
int main()
{
cout << "a is "<<a<<" and b is "<<b<<endl;
change(&a, &b);
cout << "a becomes "<<a<<" and b becomes "<<b<<endl;
}
---------------
6 `function' does not name a type
20 `change' undeclared (first use this function)
---------------
i've no ideas... plz give some comments. great thx.
Last edited: