NIOS Computer Science: Chapter 12 – Function Part 1

Download PDF of This Page (Size: 182K)

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

The # 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

Sign In