#include <iostream>
using namespace std;
#include <cstdio>
#include <cstdlib>
int main(){
int key = 0;
int t;
const void *src = "ab";
memcpy(&key,src,2);
printf("key = %08x\n",key);
printf("key = %d\n",key);
char c = *(((char*)&key)+0);
printf("key = %c\n",c);
char cc = *(((char*)&key)+1);
printf("cc = %c\n",cc);
printf("t = %d\n",t);
system("pause");
}
一个指针的实例
最新推荐文章于 2022-04-30 20:28:48 发布