C_Cpp variable naming convention

1. Camel case nomenclature

1.1 Little camel case method
Except for the first word, capitalize the first letter of other words (usually used for: variables)

int myStudentNumber

1.2 The Big Hump Method (Pascal Nomenclature)

The first letter of each word is capitalized (usually used for: class name, function name, attribute, namespace)

class StudentFamily
  1. Hungarian nomenclature
    variable name = attribute + type + object description. The advantage of this is that the programmer has an intuitive understanding of the variable's type and other attributes when he first sees the variable.

2.1 Hungarian nomenclature-attributes
Insert picture description here

.2 Hungarian Nomenclature-Type
Insert picture description here

2.3 Hungarian nomenclature-description
Insert picture description here
3. Underscore nomenclature
All letters are lowercase, and each word is separated by underscore

int student_number

4. Examples

  m_iMyData 是一个匈牙利命名法,m_表示它是成员变量,小写的i说明了它是个整型,后面的和帕斯卡命名相同,指示了该变量的用途
 
  myData 是一个骆驼命名法,它第一个单词的第一个字母小写,后面的单词首字母大写,看起来像一个骆驼
 
  MyData 就是一个帕斯卡命名的示例
 
  my_data 是一个下划线命名的示例

Guess you like

Origin blog.csdn.net/Interesting1024/article/details/109109280