Linux之Hello World

 

1  Source code for hello.c

1 /* hello.c */
2 #include <stdlib.h>
3 #include <stdio.h>
4 
5 int main()
6 {
7   printf("Hello World!\n");
8   exit(0);
9 }

 

2  Compile, link and run

$ gcc -o hello hello.c
$ ./hello
Hello World!

 If you forget the -o name option that tells the compiler where to place the executable, it will place the program in a file called a.out (meaning assembler output). 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。