C++ function parameters: use a reference or a pointer (and then dereference)?

后端 未结 11 2358
臣服心动
臣服心动 2021-02-05 10:49

I was given some code in which some of the parameters are pointers, and then the pointers are dereferenced to provide values. I was concerned that the pointer dereferencing wou

11条回答
  •  半阙折子戏
    2021-02-05 11:02

    This will get voted down since it's Old Skool, but I often prefer pointers since it's easier to just glance at code and see if my objects that I am passing to a function could get modified, especially if they are simple datatypes like int and float.

提交回复
热议问题