How many parameters can be passed to a function in c++ ?

Showing Answers 1 - 27 of 27 Answers

radha

  • Dec 28th, 2006
 

zero or more

  Was this answer useful?  Yes

Mike

  • Jan 23rd, 2007
 

zero is certainly an acceptable answer as it is a valid number.

  Was this answer useful?  Yes

Nitin Bhatt

  • Jan 26th, 2007
 

Hi all, I was trying to find the upper limit to as to how many parameters I can pass on to a function, I tried it till 700, the compiler (VC++ 6.0) was showing some warnings, but no errors. The answer zero is perfectly fine.

Example

int functionCall()

This is a function that takes ZERO parameters.

Regards
Nitin Bhatt

  Was this answer useful?  Yes

swetha

  • Feb 20th, 2007
 

We can pass any no.of parameters.The upperlimit can be found out by knowing the stack size for that function alloted by the operating system.Therefore it is dependent upon the operating system how much stack it is allocating.

  Was this answer useful?  Yes

gill

  • Aug 27th, 2011
 

Arguments passed in a function are stored in the stack rather than the heap. Thus it depends on how much memory does the O.S allocates for stack in your program. There would still be practically no limitation for a code of any respectable size.
Stack overflow however might cause your program to crash in case of a buggy code.
Theoretically speaking, you can pass as much arguments as you need to.

  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