C++ Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
C++ Tutorial
C++ Language Tutorial - Object Oriented Programing - OOPs History of C++
C++ Language Tutorial - Object Oriented Programing - OOPs Structure of C++
C++ Language Tutorial - Object Oriented Programing - OOPs C++ Datatypes
C++ Language Tutorial - Object Oriented Programing - OOPs Variables
C++ Language Tutorial - Object Oriented Programing - OOPs Constants
C++ Language Tutorial - Object Oriented Programing - OOPs Operators
C++ Language Tutorial - Object Oriented Programing - OOPs Control Structures
C++ Language Tutorial - Object Oriented Programing - OOPs Arrays
C++ Language Tutorial - Object Oriented Programing - OOPs Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Class
C++ Language Tutorial - Object Oriented Programing - OOPs Predefined Functions
C++ Language Tutorial - Object Oriented Programing - OOPs I/O Functions
C++ Language Tutorial - Object Oriented Programing - OOPs String, Character Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Mathematical Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Time Date Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Dynamic Allocation
C++ Language Tutorial - Object Oriented Programing - OOPs Utility Functions
C++ Language Tutorial - Object Oriented Programing - OOPs OOP's Concept
C++ Language Tutorial - Object Oriented Programing - OOPs Special Topics
C++ Language Tutorial - Object Oriented Programing - OOPs Type casting
C++ Language Tutorial - Object Oriented Programing - OOPs Feedback
C++ Language Tutorial - Object Oriented Programing - OOPs Ask Your Doubts
 





Utility Functions in C++


Tutorials Cpp

Topic

What are Utility functions in C++?



Explanation

The standard function has several utility functions for number of conversions, variable-length, argument processing, sorting and searching, and random number generation. To use these function the header <cstdlib> is required.

This header defines the types "div_t", "ldiv_t", "size_t". Following table lists the macros supported by <cstdlib> header.

Following table lists macros supported by utility functions of C++ Standard function Library.

EXIT_SUCCESS
Macro Description
MB_CUR_MAX Maximumlength in bytes of a multibyte character.
NULL A null pointer.
RAND_MAX Maximum value returned by the rand() function.
EXIT_FAILURE Value retruned to calling process if program is terminated unsuccessfully.
Value retruned to calling process if program is terminated successfully.

The following table lists the important utility functions of C++ Standard Function Library.

Functions Description
abort Terminates the program abnormally.
abs Returns the absolute value of the number.
atof Converts a string into a double value.
atoi Converts a string into a integer value.
atol Converts a string into a long value.
bsearch Performs a binary search on an array.
div Returns the numerator, denominator of an integer value and quotient, remainder for a long value.
exit Causes normal and immediate termination of a program.
getenv Returns a pointer to the environmental variable for the given argument.
qsort Function is used to quicksort an array.
rand Generates a random number.
srand Initializes a random number generation.









Other Links

web hosting