+ 1
=>> Tricky questions in C.
In C, like any other function, printf() and scanf() is also a function defined in studio.h then how they accept any number of arguments/parameter Example: printf("%d %d %d", a,b,c);
1 Réponse
+ 3
The 'variadic' definition creates functions with a variable number of arguments.
The operator is "...", which Javascript ES6 programmers call the 'spread' operator.
"How do varargs work in C?"
https://jameshfisher.com/2016/11/23/c-varargs.html
From the article:
void my_printf(char* format, ...);
Variables are pushed onto the stack, and it is the caller's responsibility to provide enough / proper values or risk dangerous side-effects.