The first c program

Important points about a C program

  • Every C program starts with including header files containing library of functions to be used in the program.
  • Every C program starts with a main( ) function.
  • Every statement in C program must end with a semicolon ;(unless it is a comment)
  • A main function defines a single or multiple set of statements to execute within opening and closing braces {}.

To write the first c program, open the Turbo C and write the following code:

#include< stdio.h >
void main()
{
printf("welcome to Tutorial Zone");
}

#include < stdio.h > includes the standard input output library functions. The printf( ) function is defined in stdio.h

Output:

welcome to Tutorial Zone

int main() The main() function is the entry point of every program in c language.

printf() The printf() function is used to print data on the console.

How to compile the c program:

There are two ways to compile the c program by menu and by shortcut.:

By Menu:

Click on the compile menu then compile sub menu to compile the c program.

By shortcut:

press alt+f9 keys compile the program directly.

compile Screen.

There are two ways to run the c program by menu and by shortcut.:

By Menu:

Click on the run menu then run sub menu to run the c program.

By shortcut:

press ctrl+f9 keys run the program directly.

run Screen.