Computer Science, asked by aib7humMeghagowr, 1 year ago

What are command line arguments

Answers

Answered by thedarkknight
1
They are the arguments you provide while executing your program.
e.g.-
suppose that you want to execute a file named program.cpp

first compile it using
g++ program.cpp

Then you can pass command line arguments like-
./a.out arg1 arg2 arg3
arg1,arg2 and arg3 are passed into the program and you can use them in the program.
Answered by kvnmurty
0
Often a command to the operating system like MSDOS , Unix, Linux or other is given in an interactive mode... (like  command line window on Windows)

A software program is written and compiled into an executable binary file. The program is executed by typing its name explicitly on the prompt displayed by the operating system.

As the program is usually executed non-interactively the various data inputs to the program during the run time, are given at the same time as typing the program name.   The parameters are typed after the program name.

The command line arguments are analysed inside a program to select the correctness of data and appropriate logic branch is executed inside the program.

For example. on Windows, if a Word document is clicked twice, the application Word is invoked with a command line argument as the (path) name of the file.  Inside the Word application then the file is opened and the contents are displayed.
Similar questions