== Uses ==
===API in procedural languages===
In most procedural languages, an API specifies a set of [[subroutine|functions or routines]] that accomplishes a specific task, or are allowed to interact with a specific software component. This specification is presented in a human readable format in paper books or in electronic formats like eBooks or as [[man page]]s. For example, the math API on [[Unix]] systems is a specification on how to use the mathematical functions included in the math library. Among these functions there is a function named <code>sqrt()</code>, that can be used to compute the square root of a given number.
The Unix command <code>man 3 sqrt</code> presents the [[Type signature#Signature|signature]] of the function <code>sqrt</code> in the form:
<source lang="C">
SYNOPSIS
#include <math.h>
double sqrt(double X);
float sqrtf(float X);
DESCRIPTION
sqrt computes the positive square root of the argument. ...
RETURNS
On success, the square root is returned. If X is real and positive...
</source>
This description means that <code>sqrt()</code> function returns the square root of a positive floating point number (<code>single</code> or <code>double</code> precision), as another floating point number.
The man page also states that the calling program must include the <code>math.h</code> header file to be able to reference the functions present in the math library.
Hence the API in this case can be interpreted as the collection of the [[include file]]s used by a program, written in the C language, to reference that library function, and its human readable description provided by the [[man page]]s.
Similarly, other languages have procedural libraries; for example, [[Perl]] has dedicated APIs for the same mathematical task with built-in documentation available, which is accessible using the [[perldoc]] utility:
<source lang="perl">
$ perldoc -f sqrt
sqrt EXPR
sqrt #Return the square root of EXPR. If EXPR is omitted, returns
#square root of $_. Only works on non-negative operands, unless
#you've loaded the standard Math::Complex module.
</source>
===API in object-oriented languages===
|