Академический Документы
Профессиональный Документы
Культура Документы
BSCE-2 ES201
C Programming Libraries and their Functions
1 stdio.h This is standard input/output header file in which Input/Output functions are declared
3 string.h All string related functions are defined in this header file
5 math.h All maths related functions are defined in this header file
6 time.h This header file contains time and clock related functions
7 ctype.h All character handling functions are defined in this header file
This function is used to print the character, string, float, integer, octal and hexadecimal values onto
the output screen.
printf()
1 intprintf(constchar*format,...)
This function is used to read a character, string, numeric data from keyboard.
2 scanf() intscanf(constchar*format,...)
4 gets() char*gets(char*str)
5 getchar() intgetchar(void)
6 puts() intputs(constchar*str)
24 f putchar intputchar(intchar)
25 f seek() int fseek (FILE *stream, long int offset, int whence)
33 sscanf() intsscanf(constchar*str,constchar*format,...)
deletes a file
34 remove() intremove(constchar*filename)
flushes a file
1 clrscr() clrscr();
2 getch() getch();
3 getche() getche();
Returns 0 if str1 is same as str2. Returns <0 if strl < str2. Returns >0 if str1 > str2.
Same as strcmp() function. But, this function negotiates case. “A” and “a” are treated as
same.
11 strncpy() char * strncpy ( char * destination, const char * source, size_t num )
It is used to initialize a specified number of bytes to null or any other value in the buffer
It is used to copy a specified number of bytes from one memory to another or to overlap
on same memory.
It is used to compare specified number of characters from two buffers regardless of the
21 memicmp() case of the characters
It is used to locate the first occurrence of the character in the specified string
This function is used to allocate space in memory during the execution of the
program.
This function modifies the allocated memory size by malloc () and calloc ()
functions to new size
This function frees the allocated memory by malloc (), calloc (), realloc () functions and returns the
memory to the system.
4 free() voidfree(void*ptr)
This function returns the absolute value of an integer . The absolute value of a number is always
positive. Only integer values are supported in C.
5 abs() intabs(int x)
7 abort() voidabort(void)
This function terminates the program and does not return any value
9 system() intsystem(constchar*command)
10 atoi() intatoi(constchar*str)
12 atof() doubleatof(constchar*str)
13 strtod() doublestrtod(constchar*str,char**endptr)
14 strtol() longintstrtol(constchar*str,char**endptr,intbase)
15 getenv() char*getenv(constchar*name)
This function displays most recent error that happened during library function call.
18 perror() voidperror(constchar*str)
19 rand() intrand(void)
This function Suspends the execution of the program for particular time
This function returns the nearest integer which is less than or equal to the argument passed to this
function.
This function returns the nearest integer value of the float/double/long double argument passed to
this function. If decimal value is from “.1 to .5”, it returns integer value less than the argument. If
decimal value is from “.6 to .9”, it returns the integer value greater than the argument.
This function returns nearest integer value which is greater than or equal to the argument passed to
this function.
This function is used to calculate the exponential “e” to the xth power.
This function is used to find square root of the argument passed to this function.
15 trunc.(.) This function truncates the decimal value from floating point value and returns integer value.
Monceda, Catherine H. BSCE-2 ES201
double trunc (double a);
1 setdate() structtimesetdate(structtime);
This function is used to get the difference between two given times
6 strftime() size_t strftime(char *str, size_t maxsize, const char *format, const struct tm *timeptr)
This function shares the tm structure that contains date and time informations
This function shares the tm structure that contains date and time informations
This function is used to return string that contains date and time informations
Tm structure contents are interpreted by this function as calendar time. This time is converted into
string.
2.isdigit( ) function in C language checks whether given character is digit or not. Syntax for isdigit( ) function is given below.int
isdigit ( int x );
3.isalnum() function in C language checks whether given character is alphanumeric or not. Syntax for isalnum( ) function is given
below.
int isalnum ( int x );
4.isspace( ) function in C language checks whether given character is space or not. Syntax for isspace( ) function is given below.
int isspace( int x );
Monceda, Catherine H. BSCE-2 ES201
5.islower( ) function in C language checks whether given character is lower case or not. Syntax for islower( ) function is given
below.
int islower( int x );
6.isupper( ) function in C language checks whether given character is upper case or not. Syntax for isupper( ) function is given
below.
int isupper ( int x )
7.isxdigit( ) function in C language checks whether given character is hexadecimal or not. Syntax for isxdigit( ) function is given
below.
int isxdigit( int x );
8. isprint( ) function in C language checks whether given character is printable character or not. Syntax for isprint( ) function is
given below.
int isprint( int x );
9.iscntrl( ) function in C language checks whether given character is control character or not. Syntax for iscntrl( ) function is given
below.
int iscntrl( int x );
10.ispunct( ) function in C language checks whether given character is punctuation or not. Syntax for ispunct( ) function is given
below.
int ispunct( int x );
11.isgraph( ) function in C language checks whether given character is graphical character or not. Syntax for isgraph( ) function is
given below.
int isgraph( int x );
12.tolower( ) function in C language checks whether given character is alphabetic and converts to lowercase. Syntax for tolower( )
function is given below.
int tolower( int x );
13.toupper( ) function in C language checks whether given character is alphabetic and converts to uppercase. Syntax for toupper( )
function is given below.
int toupper( int x )
This function indicates the start process of variable length argument list in a
program
This function is used to fetch the arguments from variable length argument list
This function indicates the end process of variable length argument list in a
program
This function sets errno value to 0 at the beginning of the program. This value
is modified to other than 0 when an error occurs while any function call.