
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
What are the different types of keywords in C language?
Keywords are generally called as pre-defined or reserved words in a programming language. Every keyword in C language performs a specific function in a program.
Keywords cannot be used as variable names.
Keywords have fixed meanings, and that meaning cannot be changed.
They are the building block of a 'C' program.
C supports 32 keywords.
All the keywords are written in lowercase letters.
The different types of keywords are as follows −
auto | double | int | struct |
break | else | long | switch |
case | enum | register | typedef |
char | extern | return | union |
const | short | float | unsigned |
continue | for | signed | void |
default | goto | sizeof | volatile |
do | if | static | while |
Example
Given below is the C program for the Simple Calculator by using the Switch Case −
#include <stdio.h> int main(){ char Operator; float num1, num2, result = 0; printf("
Try to Enter an Operator (+, -, *, /) : "); scanf("%c", &Operator); printf("
Enter the Values for two Operands: "); scanf("%f%f", &num1, &num2); switch(Operator){ case '+': result = num1 + num2; break; case '-': result = num1 - num2; break; case '*': result = num1 * num2; break; case '/': result = num1 / num2; break; default: printf("
entered operator is invalid "); } printf("
The result of %.2f %c %.2f = %.2f", num1, Operator, num2, result); return 0; }
Output
When the above program is executed, it produces the following result −
Enter an Operator (+, -, *, /) : * Enter the Values for two Operands: 34 12 The result of 34.00 * 12.00 = 408.00
In the above example, the keywords that are used to perform a simple calculator program are as follows −
Int, char, switch, case, break, float, default, return
These words cannot be used as variables while writing the program.
- Related Articles
- What are the different types of keywords in Java?
- What are the different types of pointers in C language?
- What are different types of constants in C language?
- What are different types of data in C language?
- What are types of expressions evaluated in C Language?
- What are different types of constants in C++?
- What are the different searching techniques in C language?
- What are primary data types in C language?
- What are the different data types of arrays in C#?
- What are the different types of functions in C Programming?
- What are the different operations on files in C language?
- What are the different types of filters in C# ASP.NET WebAPI?
- What are different format specifiers used in C language?
- What are the different types of psychotherapy?
- What are the different types of DBMS?
