Simple C Program
#include <stdio.h> /* header file for program */
int main(void)
{
printf(“Welcome to C Programming \n”); return 0;
}
Comments included in the C program begins with /* and terminates with */. The comment lines describe the variables used and the job performed by a set of program instructions. Comment lines also begin with // and expand to the next line break.
All lines starting with # are preprocessor directives which means that all those directives are processed before the program is actually compiled.
The ‘#include’ directive includes the contents of a file at compile time. The header file ‘stdio.h’ contains information about input and output functions (eg: printf( )).
The function is a subroutine that contains instructions for performing a specific computation. The ‘main()’ function is where the action starts.
Every open brace ‘{‘ has a matching closing brace ‘}’. A block is a pieces of program grouped into a single unit. A block contains declarations, statement bodies, etc., executed in order.
The function ‘printf()’ is a library function used to print the desired output. The ‘\n’ is a string argument of the function printf() used to print a new line of output. It is an example of an escape sequence. ‘return 0’ statement indicates the value returned by the function ‘int main(void)’ is 0 to the operating system.
