Keywords, Identifiers, Constants, and Variables in C Programming
This tutorial covers the fundamental building blocks of the C programming language, including keywords, identifiers, constants, and variables. It explains their purpose, rules, syntax, and usage with clear examples, helping beginners understand how data is declared, named, stored, and used in C programs.
Keywords, Identifiers, Constants, and Variables in C
1. Keywords in C
Keywords are reserved words with predefined meanings in C. They cannot be used as identifiers.
Example keywords:
Example:
2. Identifiers in C
Identifiers are names used for variables, functions, arrays, and other program elements.
Rules:
- Must begin with a letter or underscore
- Can include letters, digits, and underscores
- Cannot be a keyword
- No spaces allowed
Example:
3. Constants in C
Constants are fixed values that do not change during program execution.
Types:
- Integer:
10,-5 - Float:
3.14,2.5 - Character:
'A' - String:
"Hello"
Using const:
Using #define:
4. Variables in C
Variables store data that can change during program execution.
Declaration:
Initialization: