Command Line Arguments

Tutorials Shared by the Internet Community

Advertisements


Synopsis

So here is four short programs that simply output these arguments.

Statistics

  • Total Hits - 15966

  • Total Votes - 102 votes

  • Vote Up - 45 votes

  • Vote Down - 57 votes

  • Domain - corymathews.com

  • Category - C and C++/General Development

  • Submitted By - Shekhar

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

Description

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 ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements