loliallen
loliallen

Reputation: 136

How to pass array[int] to function with out var

How to pass array[int] to function with out declare variable

void foo(int *arr);
foo([1,2,3,4]);

Upvotes: 1

Views: 60

Answers (2)

0___________
0___________

Reputation: 67546

to be out in the C# understanding

    int *arr;
    foo((arr = (int[]){1,2,3,4}));

https://godbolt.org/z/K1ao1f

Upvotes: 1

Jakob
Jakob

Reputation: 1895

Try this:

foo((int[]){1,2,3,4});

Upvotes: 1

Related Questions