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

前端 未结 23 844
渐次进展
渐次进展 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:27

    "maybe writing it as int* bar makes it more obvious that the star is actually part of the type, not part of the identifier." So I do. And I say, that it is somesing like Type, but only for one pointer name.

    " Of course this runs you into different problems with unintuitive stuff like int* a, b."

提交回复
热议问题