Scroll Down to See All▾
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1ynFunction Details : va_arg
Tva_arg(va_list ap,T type) ;
Return Type : T
Represents a placeholder for a specific type (e.g., `int`, `double`, `char *`) used in variadic functions with macros like `va_arg`. The actual type must match the argument being accessed.
Read about return values of va_arg function .
1st Parameter Type : va_list
A data type used to hold information about variable arguments passed to a variadic function. It is initialized with `va_start`, used with `va_arg`, and cleaned up with `va_end`.
1st Parameter
The variable argument list object that holds the arguments passed to a variadic function. It must have been initialized with `va_start`.
2nd Parameter Type : T
Represents a placeholder for a specific type (e.g., `int`, `double`, `char *`) used in variadic functions with macros like `va_arg`. The actual type must match the argument being accessed.
2nd Parameter
The type of the next argument to retrieve from the list.
Read more about parameters of va_arg in parameters section
The va_argfunction in C language Retrieves the next argument in a function with a variable number of arguments.
va_arg is a macro that expands to an expression of the type and value of the next argument in a call to a variadic function. It modifies ap so that the next call to va_arg returns the next argument. The type parameter is a type name specified so that the type of the object after promotion can be determined.
The va_argfunction takes 2
parameters:Retrieves the next argument in the variable argument list `ap`, interpreting it as the specified `type`. The `type` must match the type of the actual argument passed to the function. Undefined behavior occurs if the type does not match or if `va_arg` is used after all arguments have been retrieved. Must be used in conjunction with `va_start` and `va_end`.
- •va_list `ap`: The variable argument list object that holds the arguments passed to a variadic function. It must have been initialized with `va_start`.
- •T `type`: The type of the next argument to retrieve from the list.
The va_arg function return value :
- Returns the next argument in the variable argument list
Output
This example demonstrates using va_arg to retrieve integer arguments in a variadic function.