#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Explanation:
- The `#include <stdio.h>` is a preprocessor directive that includes the standard input/output library (`stdio.h`) in the program. This library provides functions like `printf()`.
- The `int main()` is the main function of the program. It serves as the entry point and execution starts from here.
- The `printf()` function is used to display output. It is part of the standard input/output library. In this case, it prints the string "Hello, World!" followed by a newline character (`\n`).
- The `return 0;` statement signifies the end of the `main()` function. By convention, returning 0 indicates successful execution of the program.
When you compile and run this C program, it will print "Hello, World!" on the console. This simple program demonstrates the basic functionality of the `printf()` function to display output in C.
0 Comments