Understanding C Program - C Programming Professional Made easy (2015)

C Programming Professional Made easys (2015)

Chapter 3 Understanding C Program

The C program has several features and steps in order for an output or function is carried out.

Basic Commands (for writing basic C Program)

The basic syntax and commands used in writing a simple C program include the following:

#include <stdio.h>

This command is a preprocessor. <stdio.h> stands for standard input output header file. This is a file from the C library, which is included before the C program is compiled.

int main()

Execution of all C program begins with this main function.

{

This symbol is used to indicate the start of the main function.

}

This indicates the conclusion of the main function.

/* */

Anything written in between this command will not be considered for execution and compilation.

printf (output);

The printf command prints the output on the screen.

getch();

Writing this command would allow the system to wait for any keyboard character input.

return 0

Writing this command will terminate the C program or main function and return to 0.

A basic C Program would look like this:

#include <stdio.h>
int main()
{
/* Our first simple C basic program */
printf(“Hello People! “);
getch();
return 0;
}

The output of this simple program would look like this:

Hello People!