A Beginner's Guide to C Programming: Hello World Program


The below code is a simple C program that prints the string "Hello World" to the console. Here is an explanation of each line of the code:

#include <stdio.h> is a preprocessor directive that includes the contents of the file "stdio.h" in the program. "stdio.h" is a header file that contains functions for input and output operations, such as the printf() function used in this program.

int main() is the main function of the program. All C programs start executing at the main function.

printf("\nHello World"); is a function call to the printf() function, which prints the string "Hello World" to the console. The \n at the start of the string is an escape sequence that represents a new line.

return 0; The return 0; statement is used to indicate that the main function has completed successfully. The value 0 is returned as the exit status of the program, which indicates a successful execution. When you run this code, it will print "Hello World" in the console.

Source Code

#include <stdio.h>
int main()
{
	printf("\nHello World");
	return 0;
}
To download raw file Click Here

Output

Hello World

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C