其他分享
首页 > 其他分享> > c速学1

c速学1

作者:互联网

1,环境centos7.4,查看是否有gcc编译器

gcc -v

结果:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=sr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootsap --enable-shared --enable-threads=posix --enable-checking=release --with-sysm-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-uniquobject --enable-linker-build-id --with-linker-hash-style=gnu --enable-languagec,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-aay --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x864-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-201502/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-ne=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
已安装效果

补充:

GCC(GNU Compiler Collection,GNU编译器套件)
是由GNU开发的编程语言译器。
GNU编译器套件包括C、C++、 Objective-C、 Fortran、Java、Ada和Go语言前端,
也包括了这些语言的库(如libstdc++,libgcj等。)
gcc全称及简介

2,实例:

#include <stdio.h> 
int main()
{
   /* hello  C 程序 */
   printf("Hello, World! \n");
   
   return 0;
}

程序主要结构:

结构概述:
预处理器指令
函数
变量
语句 & 表达式
注释

第一行 #include <stdio.h> 是预处理器指令,告诉 C 编译器在实际编译之前要包含 stdio.h 文件。
下一行 int main() 是主函数,程序从这里开始执行。
下一行 /*...*/ 将会被编译器忽略,这里放置程序的注释内容。它们被称为程序的注释。
下一行 printf(...) 是 C 中另一个可用的函数,会在屏幕上显示消息 "Hello, World!"。
下一行 return 0; 终止 main() 函数,并返回值 0。

 

标签:gcc,enable,redhat,--,4.8,编译器,速学
来源: https://www.cnblogs.com/straybirds/p/14743406.html