assert, va_arg, va_start, and va_end functions in C

assert function: It is used to write error information and then to abort the execution of a program if a is 0. If a is not zero then no operation is performed. Header file <cassert> must be included to use the assert function.


void assert(int a);

va_arg, va_start, and va_end functions: These functions are used to pass variable number of arguments to a function. Header <cstdarg> must be included to use these functions.

Syntax of va_arg:

type va_arg(va_list arguments_ptr, type);

Syntax of va_start:

void va_start(va_list arguments_ptr, last_parameters);

Syntax of va_end:

void va_end(va_list arguments_ptr);

Leave a Reply