C Programming Language has a number of library functions that do various works. This article is about The ANSI Standard C Library Function. Have a look at some of The ANSI C Standard Library Functions.
- <stdio.h>; or Input and Output Function
- <math.h>; Mathematical Function
- <signal.h>; Signals
- <stdlib.h>; Utility functions
- <time.h>; Time manipulation function
Below we are mentioning a long list of standard C library
functions. But before that, we are disclaiming a short note. The single
characters below denote some arguments.
Parameters |
Argument |
c |
character type
argument |
d |
double precision |
f |
file |
i |
integer |
l |
long integer |
p |
pointer |
s |
string |
u |
unsigned |
* |
pointer |
Now we are going deep.
<ctype.h>
Function |
Data Type
Returned |
Task to
Complete |
isalnum(c) |
int |
Determine if the argument is alphanumeric. Return nonzero value if true, if not then 0. |
isalpha(c) |
int |
Determine if the argument is alphanumeric. Return nonzero value if true, if not then 0. |
isascii(c) |
int |
Determine if the argument is an ASCII character. Return nonzero value if true, if not then 0. |
iscntrl(c) |
int |
Determine if the argument is an ASCII control character. Return nonzero value if true, if not then 0. |
isdigit(c) |
int |
Determine if the argument is a decimal digit. Return nonzero value if true, if not then 0. |
isgraph(c) |
int |
Determine if the argument is a graphic printing ASCII character. Return nonzero value if true,
if not then 0. |
islower(c) |
int |
Determine if the argument is lowercase. Return nonzero value if true, if not then 0. |
isodigit(c) |
int |
Determine if the argument is an octal number or digit. Return nonzero value if true, if not then 0. |
isprint(c) |
int |
Determine if the argument is a printing ASCII character. Return nonzero value if true, if not then 0. |
ispunct(c) |
int |
Determine if the argument is a punctuation character. Return nonzero value if true, if not then 0. |
isspace(c) |
Int |
Determine if the argument is a whitespace character. Return nonzero value if true, if not then
0. |
isupper(c) |
Int |
Determine if the argument is uppercase. Return nonzero value if true, if not then 0. |
isxdigit(c) |
int |
Determine if the argument is a hexadecimal digit. Return nonzero value if true, if not then 0. |
toascii(c) |
int |
Convert value
of argument to ANSII |
tolower(c) |
int |
Convert
letter to lowercase. |
toupper(c) |
int |
Convert
letter to uppercase. |
<math.h>
Function |
Data Type
Returned |
Task to
Complete |
acos(d) |
double |
Return the
ark cosine of d. |
asin(d) |
double |
Return the
ark sine of d. |
atan(d) |
double |
Return the
arc tangent of d. |
atan2(d1, d2) |
double |
Return the
ark tangent of d1/d2. |
ceil(d) |
double |
Return a
value rounded up to the next higher integer. |
cos(d) |
double |
Return the
cosine of d. |
cosh(d) |
double |
Return the hyperbolic cosine of d. |
exp(d) |
double |
Raise e to
the power d. |
fabs(d) |
double |
Return the absolute value of d. |
floor(d) |
double |
Return a
value rounded down to the next lower integer. |
fmod(d1, d2) |
double |
Return the remainder of d1/d2 (with the same sign as d1) |
labs(1) |
double |
Return the absolute value of 1 |
log(d) |
double |
Return the
natural logarithm of d |
Log10(d) |
double |
Return The 10-base logarithm of d. |
pow(d1, d2) |
double |
R d1 raised
to the d2 power |
sin(d) |
double |
R. the sine
of d |
sinh(d) |
double |
R. the hyperbolic sine of d |
sqrt(d) |
double |
R. the square
root of d |
tan(d) |
double |
R. the
tangent of d |
Tanh(d) |
double |
Hyperbolic
tangent of d |
<stdio.h>
Function |
Data Type
Returned |
Task to
Complete |
fclose(f) |
int |
Close file f
and R. 0 if the file is successfully closed. |
feof(f) |
int |
Determine if
an end-of-life condition has been reached. If so, R. a nonzero value,
otherwise R/Return 0. |
fgetc(f) |
int |
Enter a
single char from f file. |
scanf |
int |
Enter data
items from the standard input device |
rewind(f) |
void |
Move the
pointer to the beginning of file f |
puts(s) |
int |
Send string s
to the standard output device |
putchar(c) |
int |
Send single char
to the standard output device |
putc(c,f) |
int |
Send a single
character to file f |
printf |
int |
Send data
items to the standard output device. |
gets(s) |
char* |
Enter string s
from the standard input device |
getc |
int |
Enter a single
char from file f |
Getchar(void) |
int |
Enter a single
value from the standard input device. |
fwrite(s,i1,i2,f) |
int |
Send i2 data
items, each of size i1 bytes from string s to file f |
fread(s,i1,i2,f) |
int |
Enter i2 data
items, each of size i1 bytes from f to s |
fseek(f,1,i) |
int |
Move the
pointer for file f a distance 1 bytes from I location |
<stdlib.h>
Function |
Data Type
Returned |
Task to
Complete |
abs(i) |
int |
R. the absolute value of i |
atof(i) |
double |
Convert
string s to a double-precision quantity |
atoi(s) |
int |
Convert
string s to an integer |
atol(s) |
long |
Allocate
memory for an array having u1 elements, each f length u2 bytes. R means Return
a pointer to the beginning of the allocated space. |
calloc(u1,
u2) |
void* |
Close all
files and buffers, and terminate the program. |
exit (u) |
void |
Free a block
of allocated memory whose beginning is indicated by p |
free(p) |
void |
Free a block
of allocated memory whose beginning is denoted by p |
maloc(u) |
void* |
Allocate u
bytes of memory. |
rabd(void) |
int |
Return a
random +ve integer |
realloc(p,u) |
void* |
Allocate u
bytes of new memory. |
srand(u) |
void |
Initialize
the random number generator. |
system(s) |
int |
Pass command
strung s to the operating system. Return 0 if the command is successfully executed;
otherwise, return a nonzero value typically -1 |
<time.h>
Function |
Data Type
Returned |
Task to
Complete |
difftime(11,
12) |
double |
Return the
time difference. 11~12, where 11 and 12 represent elapsed time beyond a
designated base time |
time(p) |
long int |
Return the
numb od 2nds elapsed beyond a designated base time. |
<string.h>
Function |
Data Type
Returned |
Task to
Complete |
strcmps(s1,
s2) |
int |
Compare 2
strings lexicographically. R a -ve value if s1 is less than s2; 0 if s1 ar s2
are equal and a positive value of s1 is greater than s2. |
strcmpi(s1,
s2) |
int |
Compare 2
strings lexicographically, without regard to case. R a -ve value if s1 is
less than s2; 0 if s1 ar s2 are equal and a positive value of s1 is greater
than s2. |
strcpy(s1,
s2) |
char* |
Copy string
s2 to string s1 |
strlen(s) |
int |
R the number
of characters in string sting |
strset(s,c) |
char* |
Set all chars
within s to c |