---
# System prepended metadata

title: pointer

---

# pointer
#include <iostream> 
#include <cstring>
#include <fstream>
#include <cstdio>
#include <stdlib.h>
using namespace std;  

struct data
{
	int num;
	char name[10];
}s;

void swap(int*,int*);
void swap2(int&,int&);
void *swap3(int *);

int main()  
{  
	int b[4]={1,2,3,4},i;
    int *a=b,*c;
    struct data *ptr;
    ptr=&s;
    char hex[] = "6A";
    float e=10.0;
    float *f=&e;
  	int *d=(int*)f;
  	
    printf("%d\n",*d);
    printf("%p\n\n",*d);
    
    swap(a[2],a[3]);
    swap3(a);
    
    for(i=0;i<4;i++)
    {
    	cout<<*(a+i)<<endl;
	}
    
    return 0;
}  

void swap(int *a,int *b)
{
	*a^=*b^=*a^=*b;
}

void swap2(int &a,int &b)
{
	 a^=b^=a^=b;
}

void *swap3(int *a)
{
	*(a+1)^=*(a+0)^=*(a+1)^=*(a+0);
}