I have a function and I want to pass a char * array to it, but I do not want to create a variable just for this, for example:
char *bar[]={"aa","bb","cc"};
foobar=foo(bar);
To get around this, I tried this:
foobar=foo({"aa","bb","cc"});
But that will not work. I also tried this:
foobar=foo("aa\0bb\0cc");
It compiles with a warning, and if I run the program, it freezes.
I also tried to play with asterisks and ampersands, but I could not get it to work properly.
Is it possible? If so, how?
source
share