C标准 C99 允许 内联函数 和 可变长度数组 .因此,以下函数在C99兼容编译器中有效。
null
内联函数示例
inline int max( int a, int b) { if (a > b) return a; else return b; } a = max (x, y); /* This is now equivalent to if (x > y) a = x; else a = y; */ |
可变长度数组示例
float read_and_process( int n) { float vals[n]; for ( int i = 0; i < n; i++) vals[i] = read_val(); return process(vals, n); } |
参考资料: http://en.wikipedia.org/wiki/C99 http://en.wikipedia.org/wiki/Variable-length_array http://en.wikipedia.org/wiki/Inline_function
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END