What is Header files and Reserved words in C++

Posted by

Header files and Reserved words in C++

Header files and Reserved words in C++ are the two important components of almost every C++ programs. Below we are discussing both terminologies in detail; 

Header files

Header files also known as include files, are standard library files that have an extension of (.h) and which are used to hold declarations for other files.

Consider the following program

 

 

// header file example

#include <iostream.h>

Int main()

{

Cout << “Hello, world!” << endl;

Return 0;

}

Output of the program

Hello, world!

This program prints the string “Hello, world!” to the screen using cout. However, this program never defines cout, so how does the compiler know about the object cout? The answer for this is that cout has been declared in a header file called “iostream”. When the line #include<iostream.h> is used in the program, the compiler locates and read all the declarations from a header file named “iostream”.

What is Header files and Reserved words in C++
What is Header files and Reserved words in C++

Reserved words

Reserved words or keywords are those words which have their special meaning within the C++ language and are reserved for some specific purpose. C++ reserved words cannot be used for any other purpose in a C++ program and even cannot be used as variables. Here is a list of C++ keywords shown in the table below:

asm auto bool break case
const  const_cast  continue  default  delete 
else  enum  explicit  export  extern 
friend  goto  if  inline  int 
new  operator  private  protected public 
short  signed  sizeof static  static_cast 
this  throw  true  try  typedef 
unsigned  using  virtual  void  volatile 
 char  double   float   reinterpret_cast   mutable 
 typename   switch   union   template   return 
 namespace  dynamic_cast  class catch for 
 while   wchar_t   typeid   struct   long 
 register   do   false   -  -
Also Read  Different types of operators in c programming

Conclusion

In this article we discussed the basic C++ programming terminologies; Header files and Reserved words. To start with C++ computer programming, one should know these basic terminologies in order to proceed in the language. That’s why we discussed both the terms in detail.

6 comments

  1. Amazing article regarding Header file and reserved words. I am working on C++ around for 2 years, yet I haven’t see such an article

  2. I really can’t believe how great this site is. Keep up the good work. I’m going to tell all my friends about this place.

  3. Wow that was unusual. I just wrote an incredibly long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyways, just wanted to say wonderful blog!

Leave a Reply

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