In C, why can't I do this:
arrayfn({1.0, 2.0, 3.0});
if arrayfn
is some function that takes in one parameter of type double[]
or double*
, whichever. Trying this gives me a syntax error.
Is there a way that I could achieve something in C like this - generating and immediately passing an array known at compile time - that avoids having to spend a line of code pre-declaring and filling it?