# Standard Library Functions

## Input and Output: <stdio.h>

int printf(const char *format, ...)
The printf function provides formatted output conversion.
int scanf(const char *format, ...)
The scanf function deals with formatted input conversion.

## String Functions: <string.h>

In the following table, variables s is of type char *; cs and ct are of type const char *; and c is an int converted to char.

 char *strcpy(s,ct) copy string ct to string s, including '\0'; return s. char *strcat(s,ct) concatenate string ct to end of string s; return s. int strcmp(cs,ct) compare string cs to string ct, return <0 if cs0 if cs>ct. char *strchr(cs,c) return pointer to first occurrence of c in cs or NULL if not present. char *strstr(cs,ct) return pointer to first occurrence of string ct in cs, or NULL if not present. size_t strlen(cs) return length of cs.

In the following table, s is of type void *; ct is of type const void *; n is of type size_t; and c is an int converted to an unsigned char.

 void *memcpy(s,ct,n) copy n characters from ct to s, and return s. void *memset(s,c,n) place character c into first n characters of s, return s.

## Mathematical Functions: <math.h>

In the following table, x and y are of type double, and all functions return double.

 exp(x) exponential function ex log(x) natural logarithm ln(x), x>0. log10(x) base 10 logarithm log10(x), x>0. pow(x,y) xy. A domain error occurs if x=0 and y<=0, or if x<0 and y is not an integer. sqrt(x) square root of x, x>=0. fabs(x) absolute value |x|

## Utility Functions: <stdlib.h>

double atof(const char *s)
atof converts s to double.

int atoi(const char *s)
converts s to int.

int rand(void)
rand returns a pseudo-random integer in the range 0 to RAND_MAX, which is at least 32767.

void srand(unsigned int seed)
srand uses seed as the seed for a new sequence of pseudo-random numbers. The initial seed is 1.

void *malloc(size_t size)
malloc returns a pointer to space for an object of size size, or NULL if the request cannot be satisfied. The space is uninitialized.

void free(void *p)
free deallocates the space pointed to by p; it does nothing if p is NULL. p must be a pointer to space previously allocated by malloc.

int abs(int n)
abs returns the absolute value of its int argument.

## Date and Time Functions: <time.h>

time_t time(time_t *tp)
time returns the current calendar time or -1 if the time is not available. If tp is not NULL, the return value is also assigned to *tp.