Learning C language, hello world output

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/mrtwenty/article/details/98331774

C language as a compiled language, you need to use compiler to perform, on Centos, we use gcc to compile C language,

1, install gcc

yum -y install gcc

2. Write a C file, so that it could output hello world:

vim helloworld.c
#include <stdio.h>
int main()
{
	printf("Hello World!\n");
	//返回状态码是一个良好习惯,当其他的程序调用该程序时,我们能通过该状态码知道程序是否执行成功。
	return 0; 
}

3. Compile

gcc hellworld.c

4, execution

./a.out

Output Hello World! On that success.

Note: You can use the -o parameter to specify the file name compiled

gcc -o hello helloworld.c

 

 

Guess you like

Origin blog.csdn.net/mrtwenty/article/details/98331774