C Programming - Command Line Arguments - Discussion

Discussion Forum : Command Line Arguments - General Questions (Q.No. 1)
1.
The maximum combined length of the command-line arguments including the spaces between adjacent arguments is
128 characters
256 characters
67 characters
It may vary from one operating system to another
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
18 comments Page 1 of 2.

Divya said:   7 years ago
Friends, can anyone explain in linux?
(1)

Miclin Geo M J said:   7 years ago
Command line is nothing but the commands we give in a compiler to run the program finally for execution like ./a.out and so on.... Command line arguments is nothing but declaring the values in the command line which means that instead of providing values inside the code as int I; I am declaring after execution in the outer command line.

The argc will count the number of variables or the data you have input in the command line. *argv()(I do not have the other brace in my mobile please adjust) is to print or read the data you have provided on the command line.

Syntax to implement it in a program is as below,

Int main(int argc, char *argv())

Output:

If I am passing the values such as ./a.out 1 2 3 in the command line at the time of execution, the value if printed will be as;

Count(argc) will be 4. Command line ./a.out will be coming considered in as one count.
argv Will print all the values ./.a.out 1 2 3 to display.

Vrushali k said:   8 years ago
What is the use of argc and argv?

Haripadamaity said:   10 years ago
Can you tell me the size in Linux?

SACHIN said:   1 decade ago
How is the working of Command line argument?

Saran said:   1 decade ago
What is the use of command line argument?

Please can anyone say explanation for this?

Sanjana said:   1 decade ago
The full declaration of main looks like this:

int main ( int argc, char *argv[] )

The integer, argc is the argument count. It is the number of arguments passed into the program from the command line, including the name of the program.

The array of character pointers is the listing of all the arguments. argv[0] is the name of the program, or an empty string if the name is not available. After that, every element number less than argc is a command line argument. You can use each argv element just like a string, or use argv as a two dimensional array. argv[argc] is a null pointer.

Shahaji katale said:   1 decade ago
What is use of agrc agrv?

Kumarreddy said:   1 decade ago
Give brief discussion on command line arguments comparing with different os.

Parvesh kumar said:   1 decade ago
What is the use of command line argument and how can I use it ?


Post your comments here:

Your comments will be displayed after verification.