icp/oer/courses/c-basics/sections/01-introduction/04-libraries/content.html

21 lines
1.1 KiB
HTML

<p>
Remember the line from the hello world program <b>#include &lt;stdio.h&gt;</b>?
This is a instruction for the preprocessor to include a library to your code.
More specifically the standard library stdio.h. Libraries are a <b>set of functions
and data structure</b> you can use to make your live easier.
They are tested and optimized but more importantly; You don't have to write
everything by hand.
</p>
<p>
We talk about functions and data structures later. All you need to know is,
that they are like complex instruction you can call. Like the printf function we were using
in the beginning. Printf is a function that takes a string with placeholders, which specify the format
(hence the name printf print formated), and the inputs for the placeholders. With that it builds the final string
and prints it out to the standard output.
</p>
<p>
There are many useful libraries you can use. The standard libraries every compiler has to provide, 3rd party libraries you
can download or libraries you can write your self to reuse them later.
We will use the math.h library in this example.
</p>