老韩Linux SRE编程
int x=0;
x=x++;//使用临时变量,临时变量+1后赋值给x
printf("%d",x);//x=1
在我的编译器好像并没有实现。
让他参与运算了,x的值还是0,代码如下。
[root@hanyw-k8 c-hanyw]# cat ./addTest.c #include int main(){ int x = 0; x = x++; printf("%d
",x); int y; int res = x + y; printf("%d
", res);}[root@hanyw-k8 c-hanyw]# gcc -o addTest addTest.c[root@hanyw-k8 c-hanyw]# ./addTest00
查看操作系统版本和gcc信息
[root@hanyw-k8 c-hanyw]# cat /etc/redhat-cat: /etc/redhat-: No such file or directory[root@hanyw-k8 c-hanyw]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)[root@hanyw-k8 c-hanyw]# gcc -vUsing built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapperTarget: x86_64-redhat-linuxConfigured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linuxThread model: posixgcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
有了解的小伙伴一起探讨下?
留言与评论(共有 0 条评论) “” |