Chapter 20: Getting Input from the Command Line

Up until this point, we have not read any input for any of our programs from any source. All program data has been hardcoded in the program itself. In this chapter, we will begin exploring programming input with one of the simplest available methods—inputting from the console's command line.

We will revisit the main() function with our added knowledge of function parameters and arrays of strings. We will then explore how to retrieve strings via an argument to the main() function.

The following topics will be covered in this chapter:

  • Understanding the two forms of main()
  • Understanding how argc and argv are related
  • Writing a program to retrieve values from argv and printing them
  • Understanding how ...

Get Learn C Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.