Standard C Function Library Reference



int abs(int i);

Returns the absolute value of i;



double acos(double x);

Returns the arc cosine of the value x. x must be between -1 and 1. Returns a value between 0 and π.



double asin(double x);

Returns the arc sine of the value x. x must be between -1 and 1. Returns a value between -π/2 and π/2.



double atan(double x);

Returns the arc tangent of the value x. Returns a value between -π/2 and π/2.



double atan2(double y,double x);

Returns the arc tangent of the value y/x. Returns a value between -π and π.



double atof(char *str);

Converts a string to a double. The string must contain only digits and 'e', 'E', '.', '-' and '+' .



int atoi(char *str);

Converts a string to an integer. The string must contain only digits.



double ceil(double x);

Rounds up x to nearest integer value.



double cos(double x);

Returns the cosine of x. x is specified in degrees.



void exit(int status);

Terminates the execution of the program. If the status is 0 then it will be considered a normal exit otherwise an error induced exit.



double exp(double x);

Calculates the exponential function exp(x).



double fabs(double x);

Returns the absolute value of x. It is like abs() but works with floating point numbers rather than integers.



double floor(double x);

Rounds down x to the nearest integer.



double fmod(double x,double y);

Returns the remainder of x/y.



void free(char *ptr);

Frees the block of memory pointed to by ptr. The memory must have been previously allocated using malloc().



double log(double x);

Returns the natural log of x.



double log10(double x);

Returns the log base 10 of x.



char *malloc(int size);

Allocates a block of memory of size bytes and returns a pointer to the block. malloc returns NULL if there is insufficient free memory.



double pow(double x,double y);

Calculates x to the power y.



int puts(char *str);

This routine writes the string str to the output file and starts a new line.



int printf(char *format,...);

Prints the formatted data to the output file. The format string specifies the type and number of values to print. Some common examples include:

printf(``i = %d'',i); prints the integer value i.

printf(``x = %g'',x); prints the floating point value x.

printf(``text = %s'',str); prints the string str.

Multiple values can be printed as in printf(``%d %d %g %s'',i,j,x,str);

The format specifiers can also include field width information and justification etc. Consult a standard C text for more details.



void print(v,...);

Prints the value v which can be of any scalar type. i.e int, char, float, double or a pointer. This is not a function found in the standard C library.



double sin(double x);

Returns the sine of x. x must be specified in degrees.



int sizeof(t);

Returns the number of bytes required to store the value of type t.



double sqrt(double x);

Calculates the square root of x. x must be a positive number.



int sprintf(char str,char *format,...);

Prints the formatted data to the string str. The format string specifies the type and number of values to print. Some common examples include:

printf(``i = %d'',i); prints the integer value i.

printf(``x = %g'',x); prints the floating point value x.

printf(``text = %s'',str); prints the string str.

Multiple values can be printed as in

printf(``%d %d %g %s'',i,j,x,str);

The format specifiers can also include field width information and justification etc. Consult a standard C text for more details.



void strcat(char *dest, char *source);

Concatenates the string source to the string dest.



void strcpy(char *dest, char *source);

Copies the string source to the string dest.



int strlen(char *str);

Returns the length of the string str.



double tan(double x);

Calculates the value of the tangent of x. x should be specified in degrees.