考虑一下:
(volatile unsigned long *) 0x4000703C
此语句是否意味着我们声明了一个指针指向地址0x4000703C
?并且:
#define STEPPER (*((volatile unsigned long *)0x4000703C))
void Step(void){
STEPPER = 10;
STEPPER = 9;
STEPPER = 5;
STEPPER = 6;
}
STEPPER
是对地址0x4000703C
指针的引用,我们直接写入0x4000703C
。是否正确?
最佳答案
Does this statement mean we declare a pointer to the address
不,声明包含一个标识符,在这种情况下是一个变量名。您有一个将整数转换为指针类型的操作,指向 0x4000703C
。什么都没有声明。
STEPPER is the deference of the pointer at the address 0x4000703C, and we are writing directly to 0x4000703C. Is it correct?
是的。 0x4000703C
处有什么样的内存当然完全是系统特定的。
关于c - 具有特定地址的指针声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21749467/