[C]将整数文字转换为指针? [英] [C] casting integer literal to a pointer ?
本文介绍了[C]将整数文字转换为指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以解释一下右侧(等号后)是什么意思吗?我正在将一个整数文字转换为指针或什么?我很困惑
Can someone explain me what does the right side (after the equals sign) means ? I am casting an integer literal to a pointer or what ? I am confused
int *var = (int *)1234;
我有什么尝试过:
在CodeProject.COM中询问
What I have tried:
Asking here in CodeProject.COM
推荐答案
所有这一切都在做返回指向内存地址1234的指针,如果您尝试从代码中读取内容,则在Windows中可能会出现安全异常。
All this is doing is returning a pointer to memory address 1234, which in Windows will probably get you a security exception if you try to read what's there from your code.
这篇关于[C]将整数文字转换为指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文