I want to call a function of a library (that I can not modify)
void function(int* i, char* c);
Is there a way to call the function defining the int
and the char
on the fly?
i.e. doing something like
function(&1, &'v');
instead of
int int_1 = 1;
char char_1 = 'v';
function(&int_1, &char_v);
This would enormously decrease the length of my code while increasing readability.
As others have noted, the answer is no...
You could simulate it by overloading function
:
void function(int i, char c)
{
function(&i, &c);
}
So now you can write function(1, 'v')