G-Fact 6
The C standard C99 allows inline functions and variable-length-arrays. So following functions are valid in C99 compliant compilers.
Example for inline functions
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; */ |
chevron_right
filter_none
Example for variable length arrays
float read_and_process(int n) { float vals[n]; for (int i = 0; i < n; i++) vals[i] = read_val(); return process(vals, n); } |
chevron_right
filter_none
References:
http://en.wikipedia.org/wiki/C99
http://en.wikipedia.org/wiki/Variable-length_array
http://en.wikipedia.org/wiki/Inline_function
Recommended Posts:
- GFact 22 | (2^x + 1 and Prime)
- GFact 23 | (Brocard’s problem)
- Can C++ reference member be declared without being initialized with declaration?
- Facts and Question related to Style of writing programs in C/C++
- Dilworth's Theorem
- Storage of integer and character values in C
- Cauchy's Mean Value Theorem
- Nesbitt's Inequality
- GFact 23 | (Brocard’s problem)
- G-Fact 20 (Cayley's formula for Number of Labelled Trees)
- G-Fact 19 (Logical and Bitwise Not Operators on Boolean)
- G-Fact 18 | Finding nth Fibonacci Number using Golden Ratio
- G-Fact 17
- fseek() vs rewind() in C
- G-Fact 16



