C Program Structure

« Previous Tutorial Next Tutorial »

Program structure of a simple C program contains header files, main() function, and then program code. You will find easy in understanding the program structure of any simple C program. Let's start with C Hello World program which would print Hello World! on the output screen.

C Program Structure Example

Here is an example program, showing the general structure of a simple C program:

/* C Program Structure - This is the simplest
 * C program, prints Hello World! on the screen

void main()
	// This is single-line comment
	/* This is a multi-line comment
	 * This will print Hello World!
	printf("Hello, World! \n");

Here is the output of this C program:

c program structure

Above Example Explained

Here is the explanation of each line of the above program (Read carefully all the line):

Compile & Execute C Program

To compile and run the above C program, just download the C compiler named TurboC++. Here is the link to download this compiler
Download TurboC++
Now install this compiler, then open the compiler, and type the above code on it. After doing this, just press F9 to compile your program, and press Ctrl+F9 to run your program. You can also use this compiler to compile and run your C++ program.

More Example

Here are some more C program, that you can go for:

« Previous Tutorial Next Tutorial »