difference between pointer and reference in c?

前端 未结 9 1544
傲寒
傲寒 2020-12-25 08:11

what is the difference between pointer , reference and dereference in c?

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-25 08:54

    Pointer is an address of some data, e.g. int* a. Here a is really just the address where an int value is stored. A reference, in contrast, is another name for some variable, an alias, e.g. int a; int &b = a Here b is just another name for a: b++ has the same effect as a++.

提交回复
热议问题