Command Line Arguments

Tutorials Shared by the Internet Community


  Top Tutorials     New Tutorials     Submit     Login     Register  

Command Line Arguments

So here is four short programs that simply output these arguments.
  • Total Hits: 15623

  • Average Rating :
    URL RatingURL RatingURL RatingURL RatingURL Rating


  • Total Votes: 151 votes

  • Category: C and C++/General Development

  • Submitted on: 2008-04-16 02:18:50

  • Submitted By: Shekhar

  • Set as Favorite


Recently in a couple class projects I have needed to use command line arguments, and the first time dealing with these can be a little confusing. So here is four short programs that simply output these arguments.

What I mean by this is that I need to accept a string while I am calling the program name. For example I am running my program called printString and I want it to display the text hello. So I run it like so

./printString.c hello    More detail...

Rating Detail

 Stars  Percentage  Total Vote
 One star  Vote LeftVote MiddleVote Right 37.09%  56
 Two starsTwo star  Vote LeftVote MiddleVote Right 10.6%  16
 Three starsThree starsThree stars  Vote LeftVote MiddleVote Right 11.92%  18
 Four starsFour starsFour starsFour stars  Vote LeftVote MiddleVote Right 11.26%  17
 Five starsFive starsFive starsFive starsFive stars  Vote LeftVote MiddleVote Right 29.14%  44

Caste Your Vote

 Rating  Selection  Guidelines
 Poor:     Very disappointing, useless.
 Fair:     Below average, disappointing but not useless.
 Good:     About average in its class.
 Very Good:     Above average for its category.
 Excellent:     One of the best Tutorials in its category.