In this article keywords in C Programming we give the information about Each C word is classified as a keyword or identifier. All keywords have a definite meaning and these meanings cannot be changed.

Keywords in C Programming:

  • Each C word is classified as a keyword or identifier. All keywords have a definite meaning and these meanings cannot be changed.
  • Keywords work as the basic building blocks for program statements. A list of all C keywords is given in the table.
  • All keywords only be written in lowercase letters. There are 32 keywords in Csuch as Follow

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

Keyword in C++ Programming:

C++ has 95 reserved keywords as of the C++20 standard. These keywords have special meanings and cannot be used as identifiers (such as variable names, function names, or class names).

1. Control Flow

  • if
  • else
  • switch
  • case
  • default
  • for
  • while
  • do
  • break
  • continue
  • goto
  • return

2. Data Types

  • int
  • float
  • double
  • char
  • bool
  • void
  • wchar_t

3. Type Modifiers

  • signed
  • unsigned
  • short
  • long

 

4. Storage Class Specifiers

  • static
  • extern
  • auto
  • register
  • mutable

5. Type Qualifiers

  • const
  • volatile

6. Classes and Objects

  • class
  • struct
  • union
  • this
  • friend
  • virtual
  • private
  • protected
  • public

7. Memory Management

  • new
  • delete

 

8. Inheritance and Polymorphism

  • virtual
  • override
  • final

9. Exception Handling

  • try
  • catch
  • throw
  • noexcept

10. Namespaces

  • namespace
  • using

 

11. Templates

  • template
  • typename

12. Miscellaneous

  • inline
  • constexpr
  • static_assert
  • nullptr

13. Coroutines (C++20)

  • co_await
  • co_yield
  • co_return

 

14. Operator Keywords

  • sizeof
  • typeid
  • alignof
  • decltype
  • dynamic_cast
  • static_cast
  • reinterpret_cast
  • const_cast
  • explicit

 

15. New in C++11 and Later

  • alignas
  • char16_t
  • char32_t
  • constexpr
  • decltype
  • noexcept
  • nullptr
  • static_assert
  • thread_local
  • concept (C++20)
  • requires (C++20)

 

Identifier:

  • Use of Identifier such as to the names of variables, functions and arrays. These are use-defined names and contain a sequence of letters and numbers as the first character.
  • You can used uppercase and lowercase letters are allowed, but lowercase letters are commonly used.
  • Underscore characters are also allowed in the identifier. It is commonly used in long indicators as a link between two words.

Rules for identifiers:

  • The first letter should be in alphabetical order.
  • An identifier can only consist of letters, numbers and underscores.
  • The first 31 characters of the identifier
  • Cannot use keywords.
  • There should be no white space.

Character set:

  • The characters are mostly used to create words, numbers, and expressions depend on the computer on which the program is run. However, there is a subset of characters available that can be used on most personal, micro, mini and mainframe computers.
    The characters in C are divided into the following categories:
    Letters
    2. Digit
    3. Special character
    4. White spaces

The compiler enters the white space as long as they are not part of the string constant. White space can be used to separate words, but is restricted to characters between keywords and identifiers

Letters A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
A b c d e f g h I j k l m n o p q r s t u v w x y z
Digits 0 1 2 3 4 5 6 7 8 9
Special Characters ~ ! @ # $ % ^ & * ( {} | <> ?
White Spaces Blank Space, Tab, Carriage return, new line

C token:

  • In a piece of text, individual words and punctuation are called tokens. Similarly, the smallest individual items or units in a C program are known as C tokens.
    C has six types of tokens as shown in the picture. C programs are written using tokens and language syntax.

Constants in C Programming:

  • Constants in C refer to fixed values that do not change during program execution.
  • Constant refers to fixed values that the program cannot change.
  • Constants can be any original data type.

C has two types of constants:

  1. Numerical constant
  2. Character constant

In the C programming language, numerical constants are fixed numerical values ​​that cannot be changed during the program. These values ​​are used for calculations, data storage, or other purposes.

Types of Numerical Constants:

  1. Integer Constants:

Whole numbers without decimal point.

Can be in three formats:

  • Decimal: A number made up of 0-9 digits.
  • Octal: A number starting with 0 (e.g., 075), made up of digits 0-7.
  • Hexadecimal: starts with 0x or 0X, and consists of the digits 0-9 and A-F (or a-f).

Example:

int dec = 25;      //decimal

int oct = 031;     // octal (octal equivalent of 25)

int hex = 0x19;    // Hexadecimal (hex equivalent of 25)

Floating-Point Constants:

  • Numbers with decimal points, such as 3.14, 2.0, etc.
  • Can also be written in scientific notation (e or E), such as 2.5×1032.5 \times 10^32.5×103 as 2.5e3.

Example:

float pi = 3.14;

double large_number = 6.022e23; //scientific notation

Character Constant in C programming language is used to store a single letter, number, or symbol. It is written within single quotes ‘ ‘.

Key Points of Character Constant:

  1. Definition:

A single character is written within single quotes (‘ ‘).

Example: ‘A’, ‘7’, ‘#’, ‘ ‘ (space).

  1. Size:

A character constant is 1 byte (8 bits) in size.

It is stored internally as ASCII code (American Standard Code for Information Interchange).

  1. ASCII Value:

Each character has a unique ASCII value.

Example:

ASCII value of ‘A’ is 65.

ASCII value of ‘a’ is 97.

The ASCII value of ‘0’ is 48.

Character constants can also be used as ASCII values.

  1. Usage:

To store single characters.

For use as ASCII values ​​in calculations.

Character Constant vs String:

Occurs within single quotes (‘ ‘).        Occurs within double quotes (” “).

Stores only one character.       Can store more than one character.

Example: ‘A’ Example: “Hello”

Types of Character Constants:

  1. General Characters:

Like: ‘A’, ‘9’, ‘#’.

  1. Escape Sequences:

Special types of characters that begin with a backslash (\).

 Example:

\n : New line.                   \t : Tab.                         \ : Backslash (\).                                 \’ : Single quote (‘).

Backslash character constant:

  1. Supports special backslash character constants used in C output functions.
  2. These character combinations are known as escape sequences.
Constants Meaning
‘\a’ Audible alert
‘\b’ Back Space
‘\f’ Form Feed
‘\n’ New Line
‘\r’ Carriage Return
‘\t’ Horizontal Tab
‘\0’ Null Character
‘\” Single Quote

Some More: 

POP- Introduction to Programming Using ‘C’

DS – Data structure Using C

OOP – Object Oriented Programming 

Java Programming

DBMS – Database Management System

RDBMS – Relational Database Management System

Join Now: Data Warehousing and Data Mining 

Leave a Reply

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