The most effective way to increase your knowledge is to try new problems in a controlled way. Pick one aspect of C++ that you haven't understood before and write a program that, aside from using that one aspect, uses only things that you have already mastered. Then do what it takes to understand what your program is doing - and why.
- Andrew Koenig and Barabara Moo in 'Ruminations on C++'.
If you just read about how command line parameters are passed to main(), write a small program:
1 2 3 4 5 6 7 8
#include <iostream>
int main( int argc, char* argv[] )
{
std::cout << "#arguments (argc): " << argc << '\n' ;
for( int i=0 ; i<argc ; ++i )
std::cout << "argument #" << i << " (argv[" << i << "]): " << argv[i] << '\n' ;
}
Then run the program from the command line with different command lines, look at the output and reason about it. For example, with a program called test, try:
> ./test
> ./test one two three four
> ./test -one -two=2 three,four
Often, a few lines of code which you write and reason about is worth more than reading a thousand words.
Note to moderators: This is reproduced almost verbatim from a post that I made on another board. Please delete it if that would violate the norms of this board.