when we said that every language consists of keywords and that these keywords are only understandable by the people who speak the language.The same is with C; keywords are special words that have special meaning in the C language and are reserved by the language. That last sentence has significant meaning, so I will take about it a little later on.
To explain what a keyword is, let’s go back to our own language: English. When I write “Hello”, it’s actually a keyword in the English language. We use it when we want to greet someone. Much like “Hello”,means something that you and the compiler will understand.
Identifier: Identifiers are simply names for your items. For example, you are developing a program that contains an item which will add two numbers. You must give this item a name in your code, so that name is also referred to as an identifier because it will identify your item.I will give you many examples for identifiers later when appropriate.
Now we must differentiate between Keywords and Identifiers. Keywords are special words reserved by the language and Identifiers are names which you can use to call your items (I use the word ‘items’ because I am assuming you don’t know of C’s building blocks, such as: structs, classes, methods, etc.).
For example I can call my programming item “Michael”, which is an item that can output “Hello I like programming in C” to the screen. The item named “Michael” is an Identifier. I can’t name this item “class”, “int”,because they are reserved by C for special use. When you name your items you must apply certain rules:
The first character in the name must start with a letter (uppercase or lowercase) or an underscore (_). I.e.: “_myName”
The characters after the first can be a digit, an underscore (_), or a letter (uppercase or lowercase)
Keywords and Identifiers
Every word in C language is a keyword or an identifier. Keywords in C language cannot be used as a variable name. They are specifically used by the compiler for its own purpose and they serve as building blocks of a c program. The following are the Keyword set of C language.
some compilers may have additional keywords listed in C manual. Identifiers refers to the name of user-defined variables, array and functions. A variable should be essentially a sequence of letters and or digits and the variable name should begin with a character. Both uppercase and lowercase letters are permitted. The underscore character is also permitted in identifiers.
The identifiers must conform to the following rules.
1. First character must be an alphabet (or underscore)
2. Identifier names must consists of only letters, digits and underscore.
3. A identifier name should have less than 31 characters.
4. Any standard C language keyword cannot be used as a variable name.
5. A identifier should not contain a space
Related Articles on Basic of C Programming