How to use timer in C?

You can use a time_t struct and clock() function from time.h. Store the start time in a time_t struct by using clock() and check the elapsed time by comparing the difference between stored time and current time.