Structure of C program

A C program is a collection of one or more functions. Every function is a collection of statements and performs some specific task. The general Structure of C program -

Comments can be placed anywhere in a program and are enclosed between the delimiters /* …. */ , Single line comments // …. , #if 0 …… #endif. (….. are statements).
example :

/*   this is Example program in generic here writing about Program theme   */

#include // this is preprocessor directive
int main() {
          printf("Welcome to Onsettechie");
#if 0
         printf("this is comments part");
#endif
return 0;
}

Preprocessor directives are processed through preprocessor before the C source code passes through Compiler. the Commonly used preprocessor directives are #include including header files, #define is used to define symbolic constants and macros.
Every C program has one or more functions. Execution of every C program starts with main() function. The statement return 0 at the end of main() means that the function is terminated Successfully.
Other functions are user Defined functions, which also have local variables and C statements. They can define Before or after main() function.

Share this

Related Posts

Previous
Next Post »