Maximum combined length of command line arguments in C

What is the maximum length of command line arguments including space between adjacent arguments ?

Questions by Ajay Kanse   answers by Ajay Kanse

Showing Answers 1 - 4 of 4 Answers


  • Jul 1st, 2010

Presumably this would be (INT_MAX-1) * SIZE_MAX.  That is, each argument can presumably be up to SIZE_MAX chars, and there can be INT_MAX - 1 arguments (one being needed for argv[0], the program name).

Since the actual values of INT_MAX and SIZE_MAX are implementation defined, no maximum can be definitively given ahead of time.

That said, one might suspect the hosting OS and/or startup code would provide somewhat more stringent limits.

  Was this answer useful?  Yes


  • Jul 6th, 2010

The C language standard does not impose any maximum on command line length/number of command-line arguments (not that I could find after a cursory search, anyway); the command-line shell is usually the limiting factor in this sort of thing. 

  Was this answer useful?  Yes


  • Sep 25th, 2011

It may vary from one operating system to another

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions