Characters Set in C Language
There are a fixed number of character including alphabets, digits and some special character available in C language. You can use these character to write any keywords or identifiers in C programming.
Alphabets in C
All alphabets of English language is supported in C language. Below are the list of all alphabets.
Digits in C
All the digits of mathematics is supported in C language. Below are the list of all digits.
Special Character in C
In addition to the alphabets and digits, C language also supports some special character. Each of these have different uses. For example a special character ‘;’ is necessary after each statement or expression. Below are the list of C programming special character sets.
|SPECIAL CHARACTER SET IN C PROGRAMMING|
Keywords in C Programming
In C programming, keywords are the reserved words that can not be modified. There is specific meaning of each keyword in C programming and it is described within the compiler. These keyword can only be use to perform the task for which it is reserved. As the keywords is reserved by the compiler, these can not be use as a identifier. All the keywords is written in lower case within the program. As the c language is a case sensitive language, you must write the keywords in lower case only, otherwise it leads to syntax error during compile time. There are total 32 keywords available in C programming. These are as below-
|KEYWORDS IN C PROGRAMMING|
Use of Keywords in C Programming
Each keyword of C language have it’s different use. For example,
In the above line, int is a keyword and age is a identifier. Here, int indicates that the identifier is of integer type that means a number which may represent the age of a person. So, these way ease identifier of C programming has it different meaning and uses. You will learn the meaning and uses of all the keywords in csecorner.com in the dedicated lesson for each keywords.
Identifiers in C Pogramming
Identifiers is nothing but a name given to a memory location. This memory location may be allocated to a variable, function or to a structure etc. In simple language, you can assume that a identifier is a name given to a variable, function, structure etc.
The word identifier itself indicate that it is unique for each other. It use to identify memory location in our program and store or retrieve data from or to it whenever required. For example, in a class, each student have different roll number and using this roll number administration can access his details. As like it, the identifier is also unique for each entity. Two different entity can’t have the same name.
In the above example, age is the identifier which is name for memory location allocated to a integer variable. No other entity within the same program have the name age.
Rules to Specify an Identifier in C
As we have discussed about identifier in above, there are also some other rules must be followed by an identifier in C. Below are the list of rules that must be followed during specifying a identifiers.
- It must be unique.
- A valid identifier may have both uppercase & lowercase letter, digits and underscores. Any other special character or white space within the identifier is not allowed.
- The first letter of an identifier can’t be a digit, it must an alphabet or underscore.
- You can mentioned a identifier of any length. There is no limit of length, however the compiler only consider the first 31st character of it and discriminated other part.
- A keywords can not be use as an identifier.
- As C language is a case sensitive language, so both name and Name are two different identifiers in C.
Example of valid identifier
Example of invalid identifiers
- 1Num : It is a invalid identifier as it’s first character is a digit.
- Num& : It is a invalid identifier, as it contain a special character &.
- n um : It is a invalid identifier, as it contain a white space within it.
Note: Though you can give any name to an identifier, we recommend you to give only meaningful name. For example, if you are going to use the identifier to store a name of employee, the you can use EmployeeName or employee_name etc. It is a good programming practice and help you in better understanding of the program. It also help in improving program readability and clarity.
Difference between Keywords and Identifiers in C Language
It may consists both lower and upper case alphabets
|Basic||This is predefined and reserved by the compiler.||It is user defineed anme to variable, function or structure etc.|
|Use||It specifies the type of an entity.||It is use to access the entity.|
|Format||It consists of only alphabets||It consists of alphabets, digits and underscore|
|Case||It only consists lower case alphabets.||It may consists both lower case and upper case letter.|
|Classification||There is no classification of Keywords.||Identifiers are classified into two categories namely internal identifiers and external identifiers.|
|Starting character||Starting character of a keyword is always a lower case letter.||Starting character of an identifier may be a lower case or upper case letter or may be underscore.|
|Example||int, float, double, while, for, do, typedef etc.||employee_name, roll_no, age etc.|
Keywords and identifier are the building blocks of a C program. Both are used together to define the type of a entity and to access it. So, you need to have a good concept on both to become a good programmer.