별의 공부 블로그 🧑🏻‍💻
728x90
728x170

*Naming Rules for Variables (변수 이름 생성 규칙)


 The names of variables in the C++ language are referred to as identifiers

 The best naming convention is to choose a variable name that will tell the reader of the program what the variable represents. 

 Variables that describe the data stored at that particular memory location are called mnemonic variables.


 Rules for naming variables:

 (1) Variable names in Visual C++ can range from 1 to 255 characters. 

     To make variable names portable to other environments stay within a 1 to 31 character range.


 (2) All variable names must begin with a letter of the alphabet or an underscore(_).  

     For beginning programmers, it may be easier to begin all variable names with a letter of the alphabet.


 (3) After the first initial letter, variable names can also contain letters and numbers.

     No spaces or special characters, however, are allowed.


 (4) Uppercase characters are distinct from lowercase characters.

     Using all uppercase letters is used primarily to identify constant variables. 


 (5) You cannot use a C++ keyword (reserved word) as a variable name.


 Tip:  Some programmers use an underscore in variable names to separate parts of the name, such as shipping_weight.  

       Others prefer a "capital style" notation, such as shippingWeight to separate parts of the name. 


 NEVER use uppercase for every letter in a variable name, because uppercase names are reserved for constant variables.

 

 <Samples of acceptable variable names:>  <Samples of unacceptable variable names:>

            Grade                                        Grade(Test)

            GradeOnTest                                  GradeTest#1

            Grade_On_Test                                3rd_Test_Grade


__________________________________________________________________________________________________________________________________________________________________________

 Source from : https://mathbits.com/MathBits/CompSci/DataBasics/naming.htm


C++에서 변수 이름 생성 규칙은 다음과 같다.


(1) 변수 이름의 길이는 1글자에서 31글자 사이로 해라.

(2) 모든 변수의 이름은 알파벳이나 언더스코어(_)로 시작하라.

(3) 변수 이름의 처음 부분을 제외한 나머지 부분에 공백이나 특수문자를 제외한 문자와 숫자를 사용할 수 있다.

(4) 대소문자는 구별되고, 대문자로만 적힌 변수는 상수 변수를 나타내는데에 사용된다.

(5) C++ 키워드를 변수의 이름으로 사용할 수 없다.


: 프로그래밍 변수명 표기법 (글 참조)

728x90
그리드형(광고전용)
⚠️AdBlock이 감지되었습니다. 원할한 페이지 표시를 위해 AdBlock을 꺼주세요.⚠️
starrykss
starrykss
별의 공부 블로그 🧑🏻‍💻


📖 Contents 📖