How can I pass any number of arguments in User define function in C? -


How many arguments can I pass in defining the function in user C? What is the prototype of that function? It is similar to printf which can accept logic in any number.

For an example, see.

  #include & lt; Stdlib.h & gt; # Include & lt; Stdarg.h & gt; # Include & lt; Stdio.h & gt; Int maxf (int, ...); Zero F (zero); Main () {F (); Exit (execution success); } Ent Maxf (Int N AGRS, ...) {Register IIT i; Int Max, A; Va_list AP; Va_start (AP, N RGS); Max = VA_arg (AP, int); {If ((a = va_arg (ap, int) gt; max) max = a; for i (i = 2; i & lt; = n_args; i ++); } Va_end (AP); Maximum return; } Zero F (zero) {int i = 5; It j [256]; J [42] = 24; Printf ("% d \ n", maxf (3, i, j [42], 0)); }  

Comments

Popular posts from this blog

email - PHP mail error ... failed to open stream : permission denied -

c# - ListView onScroll event -

c - Linux mmap() error -