Keywords in C Language – BKNMU Junagadh | BCA Sem 1 Notes



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

BKNMU Junagadh NEP 2020 32 C Keywords Reserved Words C Syntax Rules
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, double
  • void, short, long
  • signed, unsigned
  • const, volatile
Control Flow & Loops
  • if, else, switch, case
  • default, goto
  • for, while, do
  • break, continue, return
Storage Classes & Structures
  • auto, register, static, extern
  • struct, union, enum
  • typedef, sizeof
1️⃣ Frequently Used Keywords & Their Descriptions

Here is how the most essential keywords operate inside a C program:

KeywordCategoryWhat It DoesExample Usage
intData TypeDeclares integer variablesint count = 5;
if ... elseControl FlowExecutes code based on a boolean conditionif (x > 0) { ... }
forLoop ControlExecutes a block of statements repeatedlyfor (i=0; i<10; i++)
returnFunction ControlExits a function and optionally returns a valuereturn 0;
constType QualifierMakes a variable's value read-only (constant)const float PI = 3.14;
sizeofCompile-time OperatorReturns the memory size (in bytes) of a data type/variablesizeof(int);
structUser-Defined TypeGroups variables of different types under one namestruct Student { ... };
typedefType DefinitionCreates an alias or nickname for an existing data typetypedef 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.

Post a Comment

Thanks for comment.

Previous Post Next Post