Function: Introduction, Objectives, Include Directive and Library Functions

Get unlimited access to the best preparation resource for UGC Home-Science: fully solved questions with step-by-step explanation- practice your way to success.

Download PDF of This Page (Size: 247K)

Image of Computer Fuction

Image of Computer Fuction

Image of Computer Fuction


Functions in C ++ are available under C++ library header files. It provides declarations of the function prototypes, class definition, etc.

For example,

double sqrt (float).

The above declaration specifies that the sqrt function takes only one argument of type float and return double type.

To make use of predefined functions, the header file (that contains the functions prototypes) must be included in a program using preprocessor directive # include.


After going through this lesson, you would be able to:

  • Familiarize with the use of # include directive and its requirement in the program

  • Define functions included in math.h, ctype.h and string.h header files

  • Explain character handling functions which help in input/output operations

  • Define inline function and function with default value.

Include Directive

  • They include directive instructs the compiler to read and include another file in the current file.

  • The compiler compiles the entire code.

  • A header file may be included in one of two ways.

# include <iostream.h>


# include “iostream.h”

  • The header file in angle brackets means that file reside in standard include directory. The header file in double quotes means that file reside in current directory.

Library Functions

  • The C language is accompanied by a number of standard library functions which carry out various useful tasks.

  • In particular, all input and output operations (e.g., writing to the terminal) and all math operations (e.g., evaluation of sines and cosines) are implemented by library functions

  • C ++ provides many built-in functions that saves the programming time.

Image of Library Function

Image of Library Function

Image of Library Function

Developed by: