C Keywords and Identifier
In this tutorial, you will learn about keywords, reserved words in C programming that are part of the Programming. Also you will learn about identifiers and how to name them.
Character set
A character set is a set of alphabets, letter and some special character that are valid in C language.
Alphabets
Uppercase : A B C .............. X Y Z
Lowercase : a b c .............. x y z
( C Accepts both uppercase and lowercase alphabets as variables and functions. )
Digits
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 and so on.
Special Character's
Whenever you write any C program then it consists of different statements, Each C program is a set of statement and each statements is different C programming language. In programming each and every character is singe language.Types Meanings
| ~ Tilde |
| ! Exclamation mark |
| # Number sign |
| $ Dollar sign |
| % Percentage |
| ^ Caret |
| & Ampersand |
| * Asterisk |
| ( Left Parenthesis |
| ) Right Parenthesis |
| _ Underscore |
| + Plus sign |
| | Vertical Bar |
| \ Black Slash |
| ` Apostrophe |
| - Minus sign |
| = Equal sign |
| { Left brace |
| } Right brace |
| [ Left bracket |
| ] Right bracket |
| : Colon |
| " Quotation mark |
| ; Semi colon |
| < Open angle Bracket |
| > Close angle bracket |
| ? Question mark |
| , Comma |
| . Period |
| / Slash |
White Space Characters
Black space, Newline, Horizontal tab, Carriage, Return and form feed.
C Keywords
Keywords are predefined, reserved words are used in programming that have special meaning in the compiler. Keywords are part of syntax and they cannot be defined as an identifier.
For example
int money;Here , int is a keyword that indicates money is a variable type of int ( Integer).
Keywords
auto , double , int , struct , break , else , long , switch , case , enum , register , type define ,char , extern , return , union , continue , for , signed , void , do , if , static , while , default ,
goto , sizeof , volatile , constant , float , short , unsigned.
All these keywords, their syntax, and application will be discussed in their respective topics. However, if you want a brief overview of these keywords without going further, List of all keywords in C programming.
C Identifiers
Identities refer to name given to entities such as variables, functions, structure etc. Identifiers must be unique. They are created to give unique name to an entity to identify its during the execution of program.For Example
int money;
double account_balance;
Here, money and account_balance are identifiers.
Also remember, identifiers name must be different from keywords. You cann't be use int as identifiers because int is Keyword.
Rules for naming identifiers
- A valid identifiers can have letters (Both Uppercase and lowercase letters), digits and underscores.
- The first letter of an identifiers should be either letter or an underscore.
- You cannot use keywords as identifiers.
- There is no rule on how long identifiers can be. However, you may run into problems in some compilers if the identifiers is longer 31 Character.
You can chose any name as an identifier if you follow the above rule, however, give meaningful names to identifiers that make sense.
0 comments:
Post a Comment