How to explain C pointers (declaration vs. unary operators) to a beginner?

前端 未结 23 866
渐次进展
渐次进展 2020-11-30 18:08

I have had the recent pleasure to explain pointers to a C programming beginner and stumbled upon the following difficulty. It might not seem like an issue at all if you alre

23条回答
  •  一向
    一向 (楼主)
    2020-11-30 18:19

    I think the devil is in the space.

    I would write (not only for the beginner, but for myself as well): int* bar = &foo; instead of int *bar = &foo;

    this should make evident what is the relationship between syntax and semantics

提交回复
热议问题