I'm new to c.I am wondering who can tell me how to use API in my c program.
API is usually an abbreviation for "Application Programmer Interface".
For any packaged routines, the program's API is the official documented
methods of getting the routines to do whatever they are supposed to.
If you have a routine that has an API, then there is nothing
special you need to do in your C program to use it. You just
#include whatever header files the API documents that it requires,
and you make the calls to the routines in the manner documented.
The rest of this discussion involves practical development matters
that the C standard leaves up to the implementation; your
implementation might have a wildly different way of handling these
matters (especially if you are using one of the "visual" compilers.)
As far as the C standard goes, there are very few rules beyond
that the implementation must give you -some- way to link different
source files together. There is no right or wrong way in the standards
for most of these points -- and that means that to find out the
right way to do these things for your particular system, you need
to ask in a newsgroup that deals with your operating system.
You may need to tell the compiler where to find the include files
for the package. The method of doing that depends on which compiler
you are using. In -most- compilers that work from the command line,
you would add an option that started with a dash followed by
an upper-case I followed by the name of the directory to look in.
For example, -I/opt/gnu/include would (usually) tell the
compiler to look for include files in the directory /opt/gnu/include
You will probably also need to tell your compiler to link
the package into your executable. The method of doing that
depends on which compiler you are using. In -most- compilers
that work from the command line, you would add an option
that started with dash followed by lower-case L followed
by a representation of the name of the library, such as
-lcrypto . The exact name you would use after the -l depends
on your compiler: fairly common is that library names
of the form libXXXX.something would become the option -lXXXX
(i.e., remove the 'lib' prefix and any suffixes.) You may also
have to tell the compiler where to find the library; fairly
common in command-line compilers is to use an option that starts
with a dash followed by an upper-case L followed by the directory
to look in; e.g., -L/opt/gnu/lib32 -lcrypto to look for
libcrypto.something in the directory /opt/gnu/lib32