BCA Sem 1 | Unit 1 | Computer Concepts & C Programming
Keywords in C Language — BKNMU Junagadh
Complete Guide to All 32 ANSI Keywords, Categories, Rules, and Code Usage
In simple words: Keywords in C are predefined, reserved words that carry fixed, special meanings to the C compiler. Because these 32 words serve as the fundamental grammar of the C language, they cannot be used as identifiers (variable names, function names, or array names).
📖 Master List of All 32 Keywords in ANSI C
Here are all 32 standard keywords recognized by ANSI C (C89/C90) compilers:
auto
break
case
char
const
continue
default
do
double
else
enum
extern
float
for
goto
if
int
long
register
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while
ℹ️ Lowercase Rule: Every single keyword in C is written entirely in lowercase letters. Words like
INT, If, or RETURN are NOT recognized as keywords by the compiler!
🔍 Categorization of C Keywords by Purpose
Data Types & Modifiers
int,char,float,doublevoid,short,longsigned,unsignedconst,volatile
Control Flow & Loops
if,else,switch,casedefault,gotofor,while,dobreak,continue,return
Storage Classes & Structures
auto,register,static,externstruct,union,enumtypedef,sizeof
1️⃣ Frequently Used Keywords & Their Descriptions
Here is how the most essential keywords operate inside a C program:
| Keyword | Category | What It Does | Example Usage |
|---|---|---|---|
int | Data Type | Declares integer variables | int count = 5; |
if ... else | Control Flow | Executes code based on a boolean condition | if (x > 0) { ... } |
for | Loop Control | Executes a block of statements repeatedly | for (i=0; i<10; i++) |
return | Function Control | Exits a function and optionally returns a value | return 0; |
const | Type Qualifier | Makes a variable's value read-only (constant) | const float PI = 3.14; |
sizeof | Compile-time Operator | Returns the memory size (in bytes) of a data type/variable | sizeof(int); |
struct | User-Defined Type | Groups variables of different types under one name | struct Student { ... }; |
typedef | Type Definition | Creates an alias or nickname for an existing data type | typedef int number; |
💻 Code Sample — Identifying Keywords in Source Code
Observe how keywords (highlighted in bold blue) form the structural backbone of C programs:
#include <stdio.h>
int main()
{
const float pi = 3.14159;
int radius = 5;
if (radius > 0) {
float area = pi * radius * radius;
printf("Area: %f\n", area);
} else {
printf("Invalid radius!\n");
}
return 0;
}
💡 Exam Tip: In theory exams, if asked to list rules for keywords, emphasize that keywords cannot be used as variable names. Writing
int double = 10; will cause a compile error!
🔄 Rules for Using Keywords in C
1
Strict Lowercase Requirement
Keywords must be written strictly in lowercase (e.g., while, not WHILE).
2
Cannot be Used as Variable Names
You cannot use keywords as identifiers (e.g., int float = 5; is invalid).
3
Predefined Meaning
The compiler already understands what each keyword does; you cannot redefine their purpose.
⚠️ Common Mistake: Newer standards like C99 added keywords like
inline and _Bool, but for university exams (BKNMU), focus on the **32 standard ANSI C keywords**.
📝 Quick Revision — Key Exam Points
- Definition: Reserved words with fixed meanings built into the C compiler.
- Total Count: Exactly 32 keywords in ANSI C (C89).
- Case Sensitivity: All keywords MUST be written in lowercase letters.
- Identifier Rule: Keywords cannot be re-purposed as variable or function names.
- Data Type Keywords:
int,char,float,double,void. - Loop Keywords:
for,while,do. - Decision Keywords:
if,else,switch,case,default. - Storage Class Keywords:
auto,register,static,extern.
Tags:
clanguage