Thứ Tư, 1 tháng 4, 2015

truyền tham số sử dụng con trỏ


#include <stdio.h>
#include <conio.h>
#include <iostream>
using namespace std;
void swap2(int* a, int* b)
{
int temp= *a;
*a=*b;
*b=temp;
}
int main()
{
int x=10, y=20;
swap2(&x,&y);
cout<<" x= "<<x
   <<" y= "<<y
   <<endl;
   getch();
   return 0;
}

Không có nhận xét nào: