Built in functions

Home / C Programming / Built in functions

Built in functions


C programming language provides a set of built-in functions that are available as part of the standard library. These functions are included in different header files and cover various areas such as input/output, string manipulation, mathematical operations, memory management, and more. Here are some commonly used built-in functions in C:

Input/Output Functions:

printf: Used to print formatted output to the standard output (console).

scanf: Used to read formatted input from the standard input (console).

getchar: Reads a single character from the standard input.

puts: Writes a string to the standard output followed by a newline character.

fgets: Reads a string from the standard input along with newline characters.


String Functions:

strlen: Calculates the length of a string.

strcpy: Copies a string from one location to another.

strcat: Concatenates two strings.

strcmp: Compares two strings for equality.

strstr: Searches for a substring within a string.

Mathematical Functions

abs: Returns the absolute value of an integer.

sqrt: Calculates the square root of a number.

pow: Raises a number to a specified power.

sin,cos, tan: Trigonometric functions.

rand: Generates pseudo-random numbers.

Memory Functions:

malloc: Allocates a block of memory dynamically.

free: Releases the memory block allocated by malloc.

calloc: Allocates and initializes a block of memory.

realloc: Resizes a previously allocated memory block.

Character Functions:

isalpha: Checks if a character is an alphabet.

isdigit: Checks if a character is a digit.

toupper: Converts a character to uppercase.

tolower: Converts a character to lowercase.