Are `x = &v` and `*x = v` equivalent?

前端 未结 6 1055
无人共我
无人共我 2020-12-31 10:21
int * x;
int v = 7;

Given this code, what is the difference between 1. x = &v , and 2. *x = v ? I understand that

6条回答
  •  醉酒成梦
    2020-12-31 11:04

    & means address of.

    * means value at.

    In x = &v the address of v is assigned to x.

    In *x = v - the value at x (the value at the address x) is assigned the value v.

提交回复
热议问题