Xref: utzoo comp.lang.c:29338 comp.lang.c++:7898 Path: utzoo!utgpu!watserv1!watmath!att!occrsh!uokmax!apple!usc!orion.oac.uci.edu!uci-ics!rfg From: rfg@ics.uci.edu (Ronald Guilmette) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: passing arrays to functions Message-ID: <26698E28.9416@paris.ics.uci.edu> Date: 3 Jun 90 22:24:40 GMT References: <2491@zipeecs.umich.edu> Reply-To: rfg@ics.uci.edu (Ronald Guilmette) Organization: UC Irvine Department of ICS Lines: 19 In article <2491@zipeecs.umich.edu> bagchi@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@ics.uci.edu) // C++ Entomologist // Motto: If it sticks, force it. If it breaks, it needed replacing anyway.