📅  最后修改于: 2023-12-03 15:31:07.141000             🧑  作者: Mango
"Hello World" is a simple program that is used to demonstrate the basic syntax of a programming language. The program's output is a greeting message, typically "Hello, world!". In this tutorial, we will show you how to write the "Hello World" program in C language.
Open a new text file in a text editor of your choice.
Copy and paste the following code into the text editor:
#include <stdio.h>
int main() {
printf("Hello, world!");
return 0;
}
Save the file with your desired name, followed by the ".c" file extension.
Open a command prompt or terminal and navigate to the directory where you saved the file. Then, compile the program using the following command:
gcc filename.c -o filename
Finally, run the program by typing the following command:
./filename
The output should be:
Hello, world!
Congratulations! You have successfully created your first C program, the "Hello World" program. With this basic understanding of C syntax, you can now move on to more complex programming concepts and applications.