August 2012
Intermediate to advanced
976 pages
30h 17m
English
main: Handling Command-Line OptionsIt turns out that main is a good example of how C++ programs pass arrays to functions. Up to now, we have defined main with an empty parameter list:
int main() { ... }
However, we sometimes need to pass arguments to main. The most common use of arguments to main is to let the user specify a set of options to guide the operation of the program. For example, assuming our main program is in an executable file named prog, we might pass options to the program as follows:
Exercises Section 6.2.4
Exercise 6.21: Write a function that takes an int and a pointer to an int and returns the larger of the int value or the value to which the pointer points. What type should you use for the pointer?
Exercise 6.22: ...
Read now
Unlock full access