Identifiers and keywords in C
Identifiers and Keywords in C Language
What is a identifier in C ?
Identifiers are names of a entities in C Language like arrays, functions, structures, unions and labels. There are certain rules to write an identifier.
Rules to write an identifier
- Any Identifier should begin with a-z/A-Z.
- Numbers are allowed in identifier only after the first character.
- No special symbols are allowed in the identifiers such as #,$,* etc.
- Spaces are not allowed in the identifiers.
Keywords in C Language
There are 32 keywords in C Language. These keywords are nothing but the special words which can be understood by the compiler at the time of execution. Keywords cannot be used as identifier.
Example: char is a keyword in C, Where it is understood by the compiler u that the value assigned to char is a character type.
KEYWORDS
- auto 17. registered
- double 18. void
- int 19. continue
- long 20. do
- break 21. if
- switch 22. for
- char 23. signed
- extern 24. while
- return 25. static
- union 26. default
- case 27. Goto
- enum 28. sizeof
- registered 29. volatile
- typedef 30. const
- struct 31. unsigned
- else 32. short
Difference between ‘Keyword’ and ‘Identifier’
Keyword:
- Keyword is a pre-defined word which must be written in lowercase only.
- It is known to the C compiler.
- These are used only for the intended purpose while the execution of program.
Identifier:
- Identifier is a user defined word which can be written in lowercase as well as uppercase.
- It is used for the developers and not known by the C compiler.
- It is preferred to have a meaningful identifier while writing a program.
What is a Variable
Variable:
A Variable is a name which holds the address of value stored in the memory. It is a temporary storage (like a container) to hold the data. To indicate the storage area, each variable must be given a unique name.
Rules to name a variable:
- The first letter of any variable must begin with a letter (or) underscore(_).
- Variable can have letters both uppercase and lowercase and digits in it.
- Length of variable can be any characters long without limit.
Note : If a variable is not assigned to any value, then it gives the garbage value as output by default in C Language.
Referred from here