passing arrays to functions

Ronald Guilmette rfg at ics.uci.edu
Mon Jun 4 08:24:40 AEST 1990


In article <2491 at zipeecs.umich.edu> bagchi at sparky.eecs.umich.edu (Ranjan Bagchi) writes:
>
>    I would like to pass an array to a function, foo(bar *a[]).
>Currently, I pass the array by first declaring it...
>
>bar *a[] = {bar *a,bar *b,bar *c,bar *d};
>
>...and then passing it to foo(bar *a[]) with foo(a).
>
>    What I would like to be able to do is avoid the first step and
>just do a ...
>
>foo({bar *a,bar *b,bar *c,bar *d});

The GNU compilers (gcc & g++) allow such an "aggregate constructor" notation.

// Ron Guilmette (rfg at ics.uci.edu)
// C++ Entomologist
// Motto:  If it sticks, force it.  If it breaks, it needed replacing anyway.



More information about the Comp.lang.c mailing list