如何在手机上编写c语言代码
清洁守则准则 (Clean Code Guidelines)
When coding, the coding style you follow can be really important. Especially when you are working with a team or you plan on sharing your code.
编码时,遵循的编码样式可能非常重要。 特别是在与团队合作或计划共享代码时。
Most of these guidelines are standard and can be applied to most programming languages. However, here you have applications and snippets with C++ code, so you can get familiar with it more easily.
这些准则中的大多数是标准的,可以应用于大多数编程语言。 但是,这里有带有C ++代码的应用程序和代码片段,因此您可以更轻松地熟悉它。
Remember that these are only recommendations for achieving clarity, which can be a personal preference. So take these pieces of advice into account but don’t take them to the letter. Sometimes breaking some of these rules can lead to cleaner code.
请记住,这些仅是实现清晰度的建议,可以个人喜好。 因此,请考虑这些建议,但不要将其付诸实践。 有时违反其中一些规则可能会导致代码更简洁。
使用好的变量名并进行注释 (Use good variable names and make comments)
Make sure you create good variable names. For example, if you are creating a game, avoid using the variable “a” and instead use something like “p1” when referring to player 1.
确保创建良好的变量名。 例如,如果要创建游戏,则在引用玩家1时,避免使用变量“ a”,而应使用类似“ p1”的名称。
The hungarian notation i