Mastering All 32 C Language Keywords for GATE 2025 – Full Explanation with Examples & Output

The Complete List of 32 Keywords in C

Mastering All 32 C Language Keywords for GATE 2025 – Full Explanation with Examples & Output

Are you a GATE 2025 aspirant from Computer Science or IT?
Then understanding the 32 keywords of C language is not just essential — it’s foundational.

These keywords form the building blocks of syntax and logic in C, and are directly asked in GATE through code tracing, memory management, data types, storage classes, and more.


📜 What Are Keywords in C?

In C programming, keywords are reserved words used by the compiler to interpret the structure and logic of a program. You cannot use them as variable names, function names, or any other identifiers.

There are 32 keywords in C, and every GATE aspirant must be fluent in their syntax, semantics, and behavior in different program contexts.


🧾 The Complete List of 32 Keywords in C

auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while

📚 Detailed Explanation of Each Keyword (with Examples + Output)

Let’s dive deep into each keyword with GATE-oriented explanation, syntax, and sample output.


1. auto

Used to declare local variables with automatic storage class. It’s redundant in modern compilers as local variables are auto by default.

void func() {
auto int x = 10;
printf("%d", x);
}
// Output: 10

2. break

Used to exit loops or switch statements before their natural termination.

for (int i = 0; i < 5; i++) {
if (i == 3) break;
printf("%d ", i);
}
// Output: 0 1 2

3. case

Defines each branch in a switch statement.

int x = 2;
switch(x) {
case 1: printf("One"); break;
case 2: printf("Two"); break;
}
// Output: Two

4. char

Used to declare character variables.

char ch = 'A';
printf("%c", ch);
// Output: A

5. const

Defines variables that cannot be modified after assignment.

const int a = 50;
// a = 100; // Error: assignment of read-only variable
printf("%d", a);
// Output: 50

6. continue

Skips the current iteration of a loop.

for (int i = 0; i < 5; i++) {
if (i == 2) continue;
printf("%d ", i);
}
// Output: 0 1 3 4

7. default

Fallback case in switch statements when no match is found.

int a = 5;
switch(a) {
case 1: printf("One"); break;
default: printf("None");
// Output: None
}

8. do

Executes loop body at least once, regardless of the condition.

int i = 0;
do {
printf("%d ", i);
i++;
} while (i < 3);
// Output: 0 1 2

9. double

Represents double-precision floating-point values.

double pi = 3.14159;
printf("%.2f", pi);
// Output: 3.14

10. else

Specifies the alternate path when if condition is false.

int a = 3;
if (a > 5)
printf("Greater");
else
printf("Smaller");
// Output: Smaller

11. enum

Defines a group of named integer constants.

enum color { RED, GREEN, BLUE };
enum color c = GREEN;
printf("%d", c);
// Output: 1

12. extern

Tells the compiler that a variable is defined elsewhere.

extern int count; // actual definition is in another file
void show() {
printf("%d", count);
}
// Output: Depends on the actual definition in another file

13. float

Represents single-precision floating point numbers.

float rate = 2.5f;
printf("%.1f", rate);
// Output: 2.5

14. for

Defines a loop with initialization, condition, and update.

for (int i = 0; i < 3; i++) {
printf("%d ", i);
}
// Output: 0 1 2

15. goto

Jumps to a labeled section of code. Use is discouraged.

goto label;
printf("This won't print");
label:
printf("Jumped");
// Output: Jumped

16. if

Conditionally executes a block of code.

int x = 7;
if (x > 5)
printf("Big");
// Output: Big

17. int

Declares integer variables.

int x = 100;
printf("%d", x);
// Output: 100

18. long

Declares long integer values.

long big = 1000000000L;
printf("%ld", big);
// Output: 1000000000

19. register

Hints that a variable should be stored in a CPU register.

register int speed = 100;
// Can't use &speed here

20. return

Ends a function and optionally returns a value.

int square(int x) {
return x * x;
}
// Output for square(5): 25

21. short

Declares a variable of shorter integer size.

short int s = 1000;
printf("%d", s);
// Output: 1000

22. signed

Used to declare variables that can hold positive and negative values.

signed int temp = -30;
printf("%d", temp);
// Output: -30

23. sizeof

Returns the size in bytes of a variable or data type.

printf("%lu", sizeof(int));
// Output: Usually 4

24. static

Retains a variable’s value across function calls.

void counter() {
static int x = 0;
x++;
printf("%d ", x);
}
counter(); counter(); counter();
// Output: 1 2 3

25. struct

Groups variables of different types together.

struct Student {
int id;
char name[20];
};

26. switch

Allows multi-way branching based on variable value.

int d = 3;
switch(d) {
case 1: printf("Mon"); break;
case 3: printf("Wed"); break;
}
// Output: Wed

27. typedef

Gives a new name to an existing type.

typedef unsigned int uint;
uint age = 21;
printf("%u", age);
// Output: 21

28. union

Similar to struct but shares memory among members.

union Data {
int i;
float f;
};
union Data d;
d.i = 10;
printf("%d", d.i);
// Output: 10

29. unsigned

Represents only non-negative values.

unsigned int count = 4294967295;
printf("%u", count);
// Output: 4294967295

30. void

Used for:

  • Functions with no return value

  • Generic pointers

void greet() {
printf("Hello");
}
// Output: Hello

31. volatile

Prevents compiler from optimizing the variable.

volatile int flag;
// Used in hardware or multi-threading contexts

32. while

Entry-controlled loop; runs as long as the condition is true.

int i = 0;
while (i < 3) {
printf("%d ", i++);
}
// Output: 0 1 2

📘 GATE Pattern-Based Questions on Keywords

  • Memory-related: auto, static, register, extern

  • Data types: int, char, float, double, short, long, signed, unsigned

  • Storage classes: const, volatile, typedef, sizeof

  • Control flow: if, else, for, while, do, switch, goto, break, continue

Deep Dive: Advanced Use Cases & Smart Learning for C Keywords in GATE & Industry


🚀 Real-World Applications of C Keywords

Understanding how keywords relate to real-world software systems makes learning more meaningful. Below are some examples:

1. Embedded Systemsvolatile, register, const

In microcontroller code, sensor input pins or memory-mapped hardware registers change outside program control.

volatile int *port = (int*) 0x400; // hardware register

📌 Why volatile? Because the value might change outside of your program’s control.


2. Operating System Kernelsextern, static

When developing OS modules or device drivers in C:

extern int total_memory;
static void update_clock();

📌 extern is used to access memory defined in another source file.
📌 static helps hide functions inside a file (modular programming).


3. Network Protocols & Driversunion, typedef

When working with data packets, unions are used to save space:

typedef union {
int i;
float f;
} PacketData;

🧠 GATE-Level Concept Questions on Keywords

Let’s create GATE-style MCQs using keywords.

❓ Question 1:

What will be the output of the following code?

int main() {
static int a = 5;
if (a-- > 0) {
main();
printf("%d ", a);
}
return 0;
}

✅ Answer:

0 0 0 0 0
🧠 Explanation: static variable retains its value across recursive calls. The printf executes during the unwinding of recursion.


❓ Question 2:

Which of the following keywords cannot be used with int?

  • A) unsigned

  • B) register

  • C) typedef

  • D) goto

✅ Answer: D

🧠 goto is used for control flow and has nothing to do with declaring data types.


❓ Question 3:

What is the output of this code?

int main() {
int x = 0;
if (x = 5)
printf("True");
else
printf("False");
}

✅ Answer: True

🧠 Assignment x = 5 returns 5 (truthy), so the if executes. This is a classic GATE trick.


🔍 Interview-Oriented Tips on Keywords

Interviewers love asking about subtle C behaviors.

✅ Tip 1: static is your friend (and sometimes enemy)

  • Use static inside a function to retain state.

  • Use it globally to limit the scope of variables or functions to the same file.


✅ Tip 2: sizeof is a compile-time operator, not a function!

int a = 10;
printf("%lu", sizeof(a)); // No function call happens here

✅ Tip 3: Always watch out for goto in code reviews

Although it’s part of C, it’s discouraged. Use break/continue or structure your logic better.


📊 Summary Table of 32 C Keywords (Quick Revision)

Keyword Category Use In Real Projects
auto Storage Class Rarely used
break Flow Control Loop exits
case Switch Logic Menu-driven systems
char Data Type Character handling
const Data Qualifier Constants, config
continue Flow Control Skipping iterations
default Switch Logic Fallback in choices
do Loop Run at least once
double Data Type Precise math
else Condition Alternative path
enum User-defined State machines, options
extern Storage Class Link between files
float Data Type Decimal precision
for Loop Counters, iteration
goto Jump Statement Avoid (bad practice)
if Condition Decisions
int Data Type Whole numbers
long Data Type Large integers
register Storage Class Low-latency variables
return Functionality Output of function
short Data Type Compact integer
signed Data Qualifier Positive + negative numbers
sizeof Operator Memory usage
static Storage Class Persistent state
struct User-defined Group data
switch Control Multi-path execution
typedef Alias Maker Code readability
union User-defined Space-efficient data sets
unsigned Data Qualifier Only positive values
void Functionality No return, generic pointer
volatile Data Qualifier Prevents compiler optimization
while Loop Condition-based execution

🧩 Additional Practical Examples (Practice-Ready Snippets)

📌 Using typedef with struct

typedef struct {
int roll;
char name[50];
} Student;

Student s1 = {101, "Deepak"};
printf("%d %s", s1.roll, s1.name);
// Output: 101 Deepak


📌 Combining unsigned and short

unsigned short int age = 25;
printf("%u", age);
// Output: 25

📌 sizeof with arrays

int arr[10];
printf("%lu", sizeof(arr));
// Output: 40 (on most systems)
Deepesh Patel

DEEPESH PATEL

✒️ Biographical Info: Deepesh Patel Deepesh Patel एक तकनीकी विशेषज्ञ, कंटेंट क्रिएटर और सामाजिक उद्यमी हैं, जो मध्य प्रदेश से ताल्लुक रखते हैं। उन्होंने B.Tech (Computer Science) की पढ़ाई पूरी की है और वे Simpli Education और Bundeli Times जैसे डिजिटल प्लेटफॉर्म्स के संस्थापक हैं। Deepesh का मुख्य उद्देश्य तकनीक, शिक्षा और समाचार को जन-जन तक पहुंचाना है, खासकर ग्रामीण और हिंदी भाषी समुदायों के लिए। वे वेब डेवलपमेंट, ऑनलाइन लर्निंग सिस्टम्स (LMS), डिजिटल मीडिया और ग्रामीण डिजिटलीकरण पर सक्रिय रूप से काम कर रहे हैं।

3 thoughts on “Mastering All 32 C Language Keywords for GATE 2025 – Full Explanation with Examples & Output

Leave a Reply

Your email address will not be published. Required fields are marked *