Hi. Im a newb programmer. I m wondering...
1.what exactly is an api. I cant seen to find a clear answer
2. How do i use them in c++
There are many different kinds of api's (application program interface), which is probably why you can't find a clear difinitive answer because there isn't one. An API is just a term used for a set of libraries that some one or some company has written that programmers can use in their programs. For example Microsoft developed the win32 api so that programmers can create MS-Windows console and GUI programs. Another example is game engines such as DirectX and OpenGL.
How to use them: first you have to study the documentation that the author has (hopefully) written. That will tell you what functions are available and how to call them. Again you won't get a difinitive answer because there isn't one.
I use them as follows:
* "library" is being used as a generic term for a programming service. Not all services are shipped (or made available) as libraries.
I have been wondering the same thing. how does one get these api's. are they header files or something.
One gets them by (purchasing and) downloading or receiving media. Most "free" C++ libraries arrive as source code which has a README file associated. That file tells you what to do to make the library and install the headers. Boost is well known and respected. Here's one of many places to find a list of stuff: http://www.thefreecountry.com/sourcecode/cpp.shtml. Beware that your OS may matter for some of these libraries.
Remember: You are not the first person to go looking for what you need, so you will find the better known of these libraries by searching on the web.
okay so is it a source code file that you call functions from, or a header file or something?
yes
so, they can be either
It all depends on how the author decides to distribute it. Many provide free source code while others, like Microsoft, generally distribute only the binary libraries and header files. Some APIs you may have to purchase while others are free.
So why don't they just call it a Library? Why the new name?
Or Class?
Every (class) library has-a API (Application Programming Interface) that is the set of accessible constants, macros, functions, (classes and their accessible parts). You think about the API when you are using the library. Every API (can be) is implemented as some collection of files such as headers, object files, (shared) libraries or whatever. You think about the way the library is implemented when you are programming the library itself. Most of us don't clearly distinguish between a "Library" and it's "API" because the context disambiguates for us, but we all understand the difference when we need to.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.