Why is the dereference operator (*) also used to declare a pointer?

前端 未结 6 878
一向
一向 2021-01-30 12:27

I\'m not sure if this is a proper programming question, but it\'s something that has always bothered me, and I wonder if I\'m the only one.

When initially learning C++,

6条回答
  •  难免孤独
    2021-01-30 13:18

    The reason is clearer if you write it like this:

    int x, *y;
    

    That is, both x and *y are ints. Thus y is an int *.

提交回复
热议问题