#include<iostream> using namespace std; void swap(int x, int y); int main() { int a,b; cout<<"enter two nos.\n"; cin>>a>>b; swap(a,b); return 0; } void swap(int &x,int &y) { int z; z=x; x=y; y=z; cout<<"first no is "<<x<<"\nsecond is "<<y; } |
abhi@abhi-desktop:~$ g++ ex3-1.cc /tmp/ccwVyPnQ.o: In function `main': ex3-1.cc:(.text+0x139): undefined reference to `swap(int, int)' collect2: ld returned 1 exit status |
void swap(int x, int y);
void swap(int &x,int &y)