Here is a simple "Hello, World!" program in C:
#include <stdio.h>
int main(void)
{
printf("Hello, World!\n");
return 0;
}
This program includes the stdio.h
header file, which contains declarations for functions such as printf()
. The main()
function is the entry point of the program and is where the code execution starts. The printf()
function is used to print a string to the standard output (in this case, the console). The \n
at the end of the string indicates a newline character, which causes the string to be printed on a new line. The return 0;
statement at the end of the function indicates that the program has completed successfully.
To compile and run this program, you can use a C compiler such as gcc
. For example, you can save the above code to a file called hello.c
, and then compile and run it like this:
$ gcc hello.c -o hello
$ ./hello
Hello, World!
0 Comments