- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.