我要重新学习C语言

今天无意中被彻底打击到了.

#include <stdio.h>

int getN() {
	return 100;
}

int main(int argc, char* argv[]) {
	int b[getN()];
	printf("%d:%d\n", sizeof(b), sizeof(int));
return 0;
}

 

gcc version 4.0.1 (Apple Inc. build 5493)

gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)

均编译ok

 

混乱了一阵后, 发现是C99增加的
C99 introduced several new features, including inline functions, several new data types (including long long int and a complex type to represent complex numbers), variable-length arrays, support for variadic macros (macros of variable arity) and support for one-line comments beginning with //, as in BCPL or C++. Many of these had already been implemented as extensions in several C compilers.

 

看来要好好看看C99了

3 thoughts on “我要重新学习C语言”

  1. 在DEVC 试了下,的确行的,可是那段英文还是没看懂………………..
    ps.第一次来面具的博客,嘿嘿,以前没发现

    [回复]

发表评论

邮箱地址不会被公开。 必填项已用*标注