#include "stdafx.h"
#include <iostream.h>
int main(int argc, char* argv[])
{
unsigned char c[11]="0123456789";
cout<<sizeof(char)<<endl;
cout<<sizeof(int)<<endl;
cout<<"&c="<<int(c)<<endl;
cout<<"&c[0]=0x"<< int (&c[0])<<endl;
unsigned char *ch=c;
unsigned int *a=(unsigned int *)ch;
cout<<endl<<endl;
for(int j=0;j<4;j++)
{
cout<<hex;
cout<<int(c[j])<<endl<<dec;
}
cout<<hex;
cout<<"a="<<a<<endl;
cout<<"*a="<<*a<<endl;;
cout<<"*a+1="<<*(a+1)<<endl;;
return 0;
}
输出结果:
1
4
&c=1245044
&c[0]=0x1245044
30
31
32
33
a=0x0012FF74
*a=33323130
*a+1=37363534