age.printf() function.
#include <stdio.h>
int main()
{
int age = 25;
printf("Age = %d", age);
return 0;
}
Age = 25
This program demonstrates the use of keywords and identifiers in C. Keywords are reserved words that have predefined meanings, whereas identifiers are user-defined names used for variables, functions, arrays, and other program elements.
In the above program, several keywords and identifiers are used. Understanding the difference between them is essential for writing valid C programs.
| Category | Example | Description |
|---|---|---|
| Keyword | int | A reserved word used to declare an integer data type. |
| Keyword | return | Used to return control from the function. |
| Identifier | main | Name of the main function where program execution begins. |
| Identifier | age | User-defined variable used to store an age value. |
| Identifier | printf | Standard library function used to display output. |
Here, int and return are keywords because they are predefined by the C language. The names main, age, and printf are identifiers because they identify program elements such as functions and variables. Identifiers help programmers give meaningful names to data and functions, making programs easier to read and maintain.
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.