I encounter a compilation error, saying that variable-sized object 'fib' may not be initialized.
I don't want to initialize fib[1], fib[2] one-by-one.
How can I solve this problem?
@ Nikko YL: in C++ you may not declare an array with a length unknown at compile-time.
Maybe you should use std::vector instead (and hopefully your compiler supports C++11 initializer lists).
With vectors, you do not need to worry about size, as they resize automatically when you add elements. You can still use std::vector::reserve() to hint at the ideal size.
Yes, you can think of it like that. C++11 is the current standard of C++.
C++98 - from 1998, first standard
C++03 - from 2003, identical to C++98 (improved for compiler/library programmers)
C++0x - the "prototype" of C++11
C++11 - from 2011, major improvements over C++98
C++1y - the "prototype" of C++14
C++14 - planned for next year, minor improvements like C++03
C++17 - planned for 2017, major improvements like C++11