passing arrays to functions

Ranjan Bagchi bagchi at sparky.eecs.umich.edu
Mon Jun 4 05:14:54 AEST 1990


    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});
 
Simply because foo is an initialization routine, and I really have no
use for a (as defined about 10 lines up) elsewhere in the program.
 
Anyway, is there any way to get past the compiler complaints, and
manage to do something in a form like this?
 
    E-mail please, as I don't read this group regularly...
 
    -rj
    bagchi at eecs.umich.edu



More information about the Comp.lang.c mailing list