Hello, World
Here is a simple "Hello World" program in C:
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Steps to Compile and Build
Save the code: Save the above code in a file named
hello.c
.Open a terminal: Navigate to the directory where
hello.c
is saved.Compile the code: Use the
gcc
compiler to compile the code. Run the following command:gcc -o hello hello.cRun the executable: After compilation, an executable file named
hello
(orhello.exe
on Windows) will be created. Run it using:./hello
This will output:
Hello, World!
Last modified: 01 January 2025