Placement of the asterisk in pointer declarations

前端 未结 13 1153
闹比i
闹比i 2020-11-22 04:36

I\'ve recently decided that I just have to finally learn C/C++, and there is one thing I do not really understand about pointers or more precisely, their definition.

13条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 05:24

    4, 5, and 6 are the same thing, only test is a pointer. If you want two pointers, you should use:

    int *test, *test2;
    

    Or, even better (to make everything clear):

    int* test;
    int* test2;
    

提交回复
热议问题