how to print hello world in c
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
#include <stdio.h>
: This line includes the standard input/output library header file,stdio.h
, which contains functions likeprintf
that we will use to display output on the screen.int main() {
: This line declares themain
function, which is the entry point of a C program. Theint
keyword indicates that the function returns an integer value. The empty parentheses()
indicate that themain
function takes no arguments.printf("Hello, World!");
: This line uses theprintf
function to display the string"Hello, World!"
on the screen. Theprintf
function is a standard library function that allows us to print formatted output.return 0;
: This line returns the value0
from themain
function, indicating successful program execution. This value is conventionally used to indicate a successful program termination.
The complete code above will print the output "Hello, World!" when executed.