what is "forming a coinbase transaction"? So based on this after getting the right information from the pool, you will form a coinbase transaction, But how is it done in C lang.

Does the method above also works for altcoins?
The link you mentioned has a few code snippets, so I am assuming the code you want to write in C is the simple mining program. The python code can act as your pseudo code and very well write your mining program in C.

Alt coins which have been forked from bitcoin and do not have many changes in the mining algorithm can be very easily mined by the same methods described.

The most you would have to change is the hashing algorithm used which can be different from BTC's sha256.

When connecting with a mining pool,  it is generally advisable to use already existing mining softwares like cgminers wherein you just need to pass the stratum url and port (also  the hashing algorithhm in a few cases). A huge amount of code runs delegating the chunks of the mining problem to the miners connected to it.