Standard Library Functions
A library is a collection of programs and functions which can be used by other programs. Like all other high-level languages, C++ provides function libraries containing built-In functions. These standard functions are extremely useful to the programmers. The advantages of library functions are listed below:
- Reusability of code : The program development activity requires three major activities: coding, testing and debugging. If a function is developed previously, then it is available as a standard library function and the effort of redevelopment can be avoided.
- Faster development : Since many useful functions are available to the programmer, the program development process becomes faster and the productivity increases.
- Easier software maintenance : Since a function available in the library is shared by other users and programmers, the changes or modification in the function can be done at a library level. Thus, the software maintenance becomes easier.
List of Standard Library Functions
1. isalum()
This function has a prototype in ctype.h header file. The argument to this function is a character represented as an int. It performs a test "is the character alphanumeric?". An alphanumeric character is a letter of either case or a digit. The function isalnum() returns a non-zero value if the character is alphanumeric and zero otherwise.
Example:
2. isdigit()
This function has a prototype in ctype.h header file. The argument to this function is also a character represented as int. This function performs the test "is the character a digit?". It returns a non-zero value if the character is a digit and a non-zero value otherwise.
Example:
3. isalpha()
This function is exactly similar to function isdigit(), in the sense that it performs the test "is the character alphabetic?". It returns a non-zero value if the character is a letter of either case and a zero value otherwise.
Example:
4. islower()
This function is also similar to the function given above. It performs the test "is the character a lower case letter?". It returns a non-zero value for condition being true and a zero value for false.
Example:
5. isupper()
The action of this function is exactly same as islower() except that it performs the test "is the character a upper case letter?". It returns a non-zero value for condition being true and zero for false.
Example:
6. tolower()
It is a case conversion function in the sense that it converts a character to its lower case value. If the character is an upper case letter (A to Z) then it is converted to its lower case value. All other are left unchanged. The prototype of this function is also contained in ctype.h header file.
Example:
7. toupper()
It is a case conversion function. It converts a lower case character to its upper case value. The action is exactly similar to function tolower().
Example:
8. strcpy()
This function copies one string to another. The function prototype of this function is contained in string.h header file. The general form of this function call is given below:
strcpy( destination, source)
It copies the source string to destination string. The copying action stops after the null character '