#include <iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
struct st
{
int id;
char name[64];
};
void printS(struct st *sp)
{
cout<<sp->id<<" "<<sp->name<<endl;
}
void printS2(struct st &s)
{
cout<<s.id<<" "<<s.name<<endl;
}
void my_swap1(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
void my_swap2(int &a,int &b)
{
int temp;
temp=a;
a=b;
b=temp;
}
int main()
{ cout<<"指针值得交换"<<endl;
int x=10;
int y=20;
my_swap1(&x,&y);
cout<<"x="<<x<<endl;
cout<<"y="<<y<<endl;
cout<<"引用值得交换"<<endl;
int a=10;
int b=20;
my_swap2(a,b);
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
cout<<"结构体指针拷贝"<<endl;
st s1={10,"zhan3"};
printS(&s1);
cout<<"结构体引用拷贝"<<endl;
printS2(s1);
return 0;
}