text: why does the function "main()" appears in every c code? is it an optional code? what is its use? this is how you tell the c compiler where to start execution. this is not optional for a complete program. that is, the program always starts running by calling the main() function, which may call other functions in turn.  we say that main() is an "entry point" for your code, a place to start execution.