第一个C程序一一HelloWorld ■C程序约定扩展名为.c ■第一个c程序包含一个文件:first.c 1 #include <stdio.h> 2 3 int main(int argc,char *argv[]) 4{ 5 printf("Hello World!\n"); 6 return 0; 7} 8
第一个C程序 —— HelloWorld C程序约定扩展名为.c 第一个C程序包含一个文件:first.c 1 #include <stdio.h> 2 3 int main(int argc, char *argv[]) 4 { 5 printf("Hello World!\n"); 6 return 0; 7 } 8
HelloWorld的进一步解释 ■预处理 ■函数 ■主函数 通常情况下main必不可少 必main实际可以更换 必main的参数 ■1O ■返回值 更详细的解释分析留待开发工具介绍之后
HelloWorld的进一步解释 预处理 函数 主函数 通常情况下main必不可少 main实际可以更换 main的参数 IO 返回值 更详细的解释分析留待开发工具介绍之后
HelloWorld,程序编译运行结果 wgsheng@wgsheng-PC:~/calg/helloworld wgshengdwgsheng-PC:~/calg/helloworlds ls first.c wgsheng@wgsheng-PC:~/calg/helloworlds gcc first.c-o first wgsheng@wgsheng-PC:~/calg/helloworlds ls firstfirst.c wgsheng@wgsheng-PC:~/calg/helloworlds ll total 20 drwxrwxr-x 2 wgsheng wgsheng 4096 2月 1300:08 drwxrwxr-x 3 wgsheng wgsheng 40962月 1300:06 -rwxrwxr-x 1 wgsheng wgsheng 7332 2 13 00:08 first* -rw-rw-r--1 wgsheng wgsheng 972月 13 00:08 first.c wgsheng@wgsheng-PC:~/calg/helloworlds ./first Hello World! wgsheng@wgsheng-PC:~/calg/helloworlds
HelloWorld程序编译运行结果
c开发环境(PC) Windows IDE Visual Studio Intel Parallel Studio XE ■Unix/Linux gcc编译器+make系列构建工具 ■新型编译器:LLVM ■Mac IDE xcode ■跨平台DE Eclipse Codeblocks
C开发环境(PC) Windows IDE Visual Studio Intel Parallel Studio XE Unix/Linux gcc编译器+make系列构建工具 新型编译器:LLVM Mac IDE xcode 跨平台IDE Eclipse Codeblocks
Visual Studio 全功能IDE,支持C/C+、C#.. 最新2017版,有免费版Express版 ■ 安装需要近10G空间,完全安装要60G空间 需注意开发c程序文件的扩展名一定要是.c 旗舰级开发工具,代码格式化、代码高亮等功 能非常好用 最好的文档:MSDN 缺陷:屏蔽了底层过程,不利于学习
Visual Studio 全功能IDE,支持C/C++、C#... 最新2017版,有免费版Express版 安装需要近10G空间,完全安装要60G空间 需注意开发C程序文件的扩展名一定要是.c 旗舰级开发工具,代码格式化、代码高亮等功 能非常好用 最好的文档:MSDN 缺陷:屏蔽了底层过程,不利于学习