The main() function has two arguments, an integer and an array of strings. The integer argument is traditionally named argc; the string argument is traditionally named argv. The first argument is the name of the program or string used to launch the program. The main() function's arguments need not be listed if you don't plan on using them in your code.
- [Instructor] The main() function has two arguments: … an integer representing the number of strings … typed to the command prompter … specified to launch the program … in a GUI operating system … and a character pointer array … representing each string typed in the command prompt. … The main() function's arguments are required … only when you plan on using them. … Otherwise you can leave … the main() function's parentheses blank. … Here you see the arguments specified … for the main() function in this exercise file. … I've used the traditional names argc for the argument count … and argv for argument values. … The pointer notation indicates an array of strings. … The argument count is always at least one, … which represents the program name … for the command used to launch the program. … This name is the first string in the array, … element zero as specified in the printf statement … at the end of line five. … Bill and run. … You see the program name as set by the linker … unless some other name was chosen. …
- Working with arrays
- Building a structure
- Creating an array of structures
- Testing characters
- Working with strings in C
- Using pointers to manipulate data
- Manipulating files
- Using command-line arguments
- Working with time functions
Skill Level Intermediate
1. Arrays and Structures
2. Characters and Strings
4. Files and the Operating System
5. The Interesting and Extraordinary
Next steps1m 52s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.