#include <stdio.h>

int main(void){
        void *p;
        int a = 14322;
        char c  ='A';
        p = &a;
        //p = &c;
        //强制类型转换(int*)p 把变量指针p强制转换成指向int类型的指针
        printf("a=%d\n",*(int*)p);
        p = &c;
        printf("c=%c\n",*(int*)p);
        return 0;       
}

  

相关文章:

  • 2021-09-19
  • 2021-11-05
  • 2021-12-06
  • 2021-05-20
  • 2021-08-16
  • 2021-08-27
  • 2021-08-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案