Inline array declaration URGENT@@@
I want to know what the syntax is for inline array definitions (like arrays created when calling a function):
1 2 3
|
void foo(int*){};
/* ... */
foo(new int[] { 1, 2, 3 });
|
This code does not compile... I know theres a way of doing this but I can't seem to get the syntax (or find it anywhere).
If this same question apears in another thread, just post the link
Thanks,
- Alan
IIRC, it's just
foo({1,2,3});
that was what I first thought but it gives an error
1 2 3 4
|
/*
* In function `int main()':
* expected primary-expression before '{' token
*/
|
Topic archived. No new replies allowed.