C: Good Habits re: Transitioning to C++

后端 未结 13 591
梦毁少年i
梦毁少年i 2020-12-13 02:47

I\'ve been learning C at Varsity for just shy of 2months now, and next year we\'ll be moving on to C++.

Are there any habits I should get into with my C programmin

13条回答
  •  时光说笑
    2020-12-13 03:17

    Keep the languages separate.

    C and C++ can be appear similar, but they are different languages with different rules for similar constructs. If you can isolate one from the other, all the better.

    When switching to C++ be ready to unlearn (learn a different, incompatible method) about:

    1. preprocessor: In C++ you should not use the preprocessor as much as in C.
    2. strings: C doesn't have them
    3. pointers: C++ can be coded to handle them more safely

提交回复
热议问题