filmov
tv
Naming Conventions in C - C Programming Tutorial 19
Показать описание
Notes for You:: Naming Conventions in C - C Programming Tutorial 19
- the rules for naming variables and constants
1. Variable name and constant name must be meaningful and descriptive.
2. Keywords should never be used as variable name or constant name.
3. The first character can be an alphabet, or underscore.
4. The first character should not be a number.
5. All succeeding characters can be alphabets, digits, or underscores.
6. No special characters are allowed except an underscore, not even space.
7. Variable names and constant names are case sensitive.
8. White space is not allowed.
9. Use Camel case naming convention for naming variables .
i.e. if there is a single word in a variable name, then all characters should be in lower case, and if there are more than one words in a variable name, then first word’s all characters should be in lower case and all succeeding words first character should be in upper case.
10. Whereas while naming a constant, all characters should be in upper case, if there are more than one word in a constant name, then they should be separated by an underscore character.
11. No two variables or constants should have same name in the same scope.
12. Always initialize a variable and constant, when they are declared.
Example:
Valid: s, p, Num, num, score, playerScore, _flag, player9, _itemPrice, SCREEN_WIDTH, etc.
Invalid: 9thplayer, continue, while, for, etc.
=========================================
Follow the link for next video:
Follow the link for previous video:
=========================================
C Programming Tutorials Playlist:
=========================================
Watch My Other Useful Tutorials:-
Computer Programming Fundamentals Playlist:-
C Practical LAB Exercises Playlist:-
C++ Tutorials Playlist:
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #CProgramming #CProgrammingTutorial
- the rules for naming variables and constants
1. Variable name and constant name must be meaningful and descriptive.
2. Keywords should never be used as variable name or constant name.
3. The first character can be an alphabet, or underscore.
4. The first character should not be a number.
5. All succeeding characters can be alphabets, digits, or underscores.
6. No special characters are allowed except an underscore, not even space.
7. Variable names and constant names are case sensitive.
8. White space is not allowed.
9. Use Camel case naming convention for naming variables .
i.e. if there is a single word in a variable name, then all characters should be in lower case, and if there are more than one words in a variable name, then first word’s all characters should be in lower case and all succeeding words first character should be in upper case.
10. Whereas while naming a constant, all characters should be in upper case, if there are more than one word in a constant name, then they should be separated by an underscore character.
11. No two variables or constants should have same name in the same scope.
12. Always initialize a variable and constant, when they are declared.
Example:
Valid: s, p, Num, num, score, playerScore, _flag, player9, _itemPrice, SCREEN_WIDTH, etc.
Invalid: 9thplayer, continue, while, for, etc.
=========================================
Follow the link for next video:
Follow the link for previous video:
=========================================
C Programming Tutorials Playlist:
=========================================
Watch My Other Useful Tutorials:-
Computer Programming Fundamentals Playlist:-
C Practical LAB Exercises Playlist:-
C++ Tutorials Playlist:
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #CProgramming #CProgrammingTutorial
Комментарии