Skip to content Skip to sidebar Skip to footer

Keywords in C++

Keywords in C++ are the collection of reserved words and predefined identifiersThese are written in lower cases and have a special meaning defined by the compiler. There are 95 keywords in the C++ programming language, of which around 30 are unavailable in the C language. These are always used for a particular purpose in a program, but we can’t use them as variable or function names. Some examples of Keywords in C++ are break, int, void, public, private, auto, return, and many more.

Tokens in C++

Just like living cells in the human body are the possible minor units of life, we have tokens in C++, which are the smallest building blocks of a program.

In C++, we can further categorize Tokens as:

This article will primarily be about C++ keywords and their uses.

Keywords in C++

Keywords in C++ are the collection of reserved words. These are written in lower cases and have a unique meaning defined by the compiler. We can’t use them to declare variable names or function names. They’re also known as the static keyword in C++ and called local variables in the programming language.

Example

We can declare an integer variablenumber‘ with any value, but we can’t use keywords for this purpose.

int number = 5; //here, the number is a variable, and hence, it will store the value 5

int class= 5; //wrong statement, class is a keyword, not a variable

Different types of Keywords in C++

There is a list of all the Keywords in C++. As defined in C++17:

  • alignas
  • alignof
  • and
  • and_eq
  • asm
  • auto
  • bitand
  • bitor
  • bool
  • break
  • case
  • catch
  • char
  • char16_t
  • char32_t
  • class
  • compl
  • const
  • constexpr
  • const_cast
  • continue
  • decltype
  • default
  • delete
  • do
  • double
  • dynamic_cast
  • else
  • enum
  • explicit
  • export
  • extern
  • false
  • float
  • for
  • friend
  • goto
  • if
  • inline
  • int
  • long
  • mutable
  • namespace
  • new
  • noexcept
  • not
  • not_eq
  • nullptr
  • operator
  • or
  • or_eq
  • private
  • protected
  • public
  • register
  • reinterpret_cast
  • return
  • short
  • signed
  • sizeof
  • static
  • static_assert
  • static_cast
  • struct
  • switch
  • template
  • this
  • thread_local
  • throw
  • true
  • try
  • typedef
  • typeid
  • typename
  • union
  • unsigned
  • using
  • virtual
  • void
  • volatile
  • wchar_t
  • while
  • xor
  • xor_eq

FOLLOW-UP

So, now you know the maximum number of keywords in c++ and their different types in the world of programming language. If you understood and comprehended this blog properly, well done. You’re getting advanced daily. If, in any case, you’re finding it difficult, you can let us know in the comments & contact us. Besides, if you’ve any doubts, you can post them in the comments. Don’t worry; our geeks will surely get your doubts cleared soon.

Similarly, you must also know that GeekonPeak has just begun and is looking for some loyal supporters so we, the new-gen geeky friends, can grow and create more comprehensive and easy-to-grasp courses for you (for free). Follow us on FacebookInstagram & Twitter as well. Also, don’t miss our newsletter subscription. We provide exclusive blogs, tips, tricks, and advice to program efficiently and market smartly. We also promote some of our partners with excellent experiences to share with you. Until next time 🙂

Leave a comment

Sign Up to Our Newsletter

Be the first to know the latest updates