..

FreePrograms


  CONTACT US   ABOUT US   PRIVACY  DISCLAIMER

FREE C PROGRAMS 

What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming Data Structures in C C interview Questions

Command Line Arguments : - C Programming Tutorial




Command-line arguments are basically arguments sent to the program being called & are given after the name of a program in command-line operating systems and are basically passed in to the program from the operating system.

When the function main() is called then

arc :gives number of command line arguments

argv: full list of command line arguments, or array of arguments

Input file for command line argument

 

After writing the c program above save the file as CLA.C .

Now go to command prompt and type

CLA arg1 arg2

Output file for command line arguments

Here i entered my name and it prints in this way i.e to the next line.

Similarly, you can enter other arguments as shown below.

A program can take any number of command line arguments, which may be required for the program to run.

..

A Good explanation of command line arguments can be found here:

http://computer.howstuffworks.com/c38.htm

www.cprogramming.com/tutorial/c/lesson14.html

 

COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM