1 / 4

CSc 352 Command Line Processing

CSc 352 Command Line Processing. Saumya Debray Dept. of Computer Science The University of Arizona, Tucson debray@cs.arizona.edu. Accessing command line arguments. Command-line arguments to a program are given to the program as an array of (pointers to) strings char *argv[]

marlenem
Download Presentation

CSc 352 Command Line Processing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSc 352Command Line Processing Saumya Debray Dept. of Computer Science The University of Arizona, Tucson debray@cs.arizona.edu

  2. Accessing command line arguments • Command-line arguments to a program are given to the program as an array of (pointers to) strings char *argv[] • No. of arguments (= size of this array) provided separately int argc • Accessed within the program as int main(int argc, char *argv[]) program name first argument last argument

  3. Example 1 argv[0] is always the name of the executable argv[01] … argv[(argc-1)] are the command line arguments, in order

  4. Example 2 array  pointer

More Related