Question: How I can create and use dynamic and static libraries? 

Can anyone explain here in an easy way of how to create and use dynamic and static libraries in `c` and static vs dynamic libraries? And also please tell me why use `gcc -c` and `gcc -o`. I know `gcc` is a compiler but `-c` and `-o`. What is this purpose?

Answer: 
Since you don't know what `-c` (compile object file) and `-o` (specify output file) do, I would suggest to start with a simple executable compilation. Understand what are object files and how they are put together.

Proceed with static libraries. Understand that static libraries are just several object files archived together. How they are specified to the compiler and how the compiler finds them.

Then, finally, try the dynamic ones. Understand that they are linked at runtime. That you need to specify where they are found. That they are compiled and linked a different way (have you seen `-fPIC` yet?). That they can depend on each other. They are powerfull beasts that can bite you easily :)

And an *easy* way to create static and dynamic libraries? Forget about writing them manually and use cmake. If you want to go deep, run make with `VERBOSE=1`, see compiler arguments and learn.
not sure where to begin to answer your question here.

if you just consult the man page for gcc

```
 man gcc

```

It will perfectly address your question about the options and usage of gcc.

For the part of dynamic and static libraries, there is very long way to walk through and there is plenty clearly understandable documentation in the internet, for example:

```
  http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

```

is a good place to start