近年来,随着较为新式的编程语言的不断涌现,如 C++和 Golang 等,它们的声明变量或函数的方式与传统的编程语言有所不同。这种新式的声明方式通常先写名字再写类型的声明,例如:int num1, int num2。而这样的声明方式容易导致写错,例如:int max(int num1, int num2)。
为了解决这个问题,我们需要注意声明顺序,尤其是在使用新式编程语言时。只有掌握了正确的声明顺序,才能在编程中避免常见的错误。
==
英文翻译:
News Title: The issue of declaration order in programming languages
Keywords: programming languages, declaration order, C++, Golang
News Content:
In recent years, with the emergence of more modern programming languages such as C++ and Golang, their declaration of variables or functions 的方式与传统的 programming languages have changed. This new way of declaration often involves writing the name before the type declaration, for example: int num1, int num2. This can easily lead to errors, such as: int max(int num1, int num2).
To solve this problem, we need to pay attention to the declaration order, especially when using modern programming languages. Only by mastering the correct declaration order can we avoid common errors in programming.
【来源】https://www.zhihu.com/question/551736476
Views: 1