How to assign pointer address manually in C programming language?

后端 未结 3 2061
太阳男子
太阳男子 2020-11-30 19:16

How do you assign a pointer address manually (e.g. to memory address 0x28ff44) in the C programming language?

3条回答
  •  长情又很酷
    2020-11-30 19:48

    Your code would be like this:

    int *p = (int *)0x28ff44;
    

    int needs to be the type of the object that you are referencing or it can be void.

    But be careful so that you don't try to access something that doesn't belong to your program.

提交回复
热议问题