In this section, we could explain how to write a CPython extension with the C language, but the topic can take a complete book.
For this reason, we prefer to give you some links where you can read a very good documentation.
Read the following references: