Your best option is to use a debugger .
With a debugger you can run the program line by line, you can inspect the value of variables before and after each instruction or function, you can change the value of variables dynamically, ..., ...
Each compiler has its own debugger. Many IDEs integrate the debugger into the development environment in a natural way; if you use IDE the use of the debugger may not be so natural but it is perfectly reasonable.
Another way you can 'use% s and% s inside the program to see what is happening to one or more variables
for (i = 0; i < 10000; i++) {
fprintf(stderr, "DEBUGGING: i = %d; j = %d; x = %f\n", i, j, x);
/* resto do loop */
}