Can an address be assigned to a variable in C?

前端 未结 9 2026
孤城傲影
孤城傲影 2021-01-06 05:28

Is it possible to assign a variable the address you want, in the memory?

I tried to do so but I am getting an error as \"Lvalue required as left operand of assignmen

9条回答
  •  北海茫月
    2021-01-06 05:57

    I think '&' in &a evaluates the address of i at the compile time which i think is a virtual address .So it is not a Lvalue according to your compiler. Use pointer instead

提交回复
热议问题