#include<stdio.h>#include<iostream>usingnamespace std;//声明一个指针变量,必须要保存两种东西,一个地址数据,而是类型//type * pointerName// *表明了本变量为指针变量,大小固定,此处的*仅用于表示声明// 类型决定了该变量中存储的地址的寻址能力intmain(){int data =0x12345678;int*pd =&data;printf("%x\n",*pd);printf("%x\n",*(int*)pd);printf("%x\n",*(short*)pd);printf("%x\n",*(char*)pd);system("pause");return0;}intmain1(){char a =1;short b =2;int c =4;double d =5;printf("%d\n",sizeof(char*));printf("%d\n",sizeof(short*));printf("%d\n",sizeof(int*));printf("%d\n",sizeof(float*));printf("%d\n",sizeof(double*));char*pa =&a;short*ps =&b;int*pi =&c;double*pd =&d;printf("%d\n",*pa);printf("%d\n",*ps);printf("%d\n",*pi);
cout <<*pd << endl;system("pause");return0;}