Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!kddlab!titcca!sragwa!wsgw!socslgw!diamond!diamond From: diamond@diamond.csl.sony.junet (Norman Diamond) Newsgroups: comp.lang.c++ Subject: Re: Passing array of function pointers Message-ID: <10160@socslgw.csl.sony.JUNET> Date: 13 Apr 89 05:04:24 GMT References: Sender: news@csl.sony.JUNET Reply-To: diamond@diamond. (Norman Diamond) Distribution: comp.lang.c++ Organization: /usr/lib/news/organization Lines: 34 In article mleisher@nmsu.edu (Mark Leisher) asks for help with: 1 > void junk( int a, int b ) 2 > { 3 > cout << a << "\n" << b; 4 > } 5 > void fill( (*f[])(int, int) ) 6 > { 7 > int i; 8 > for ( i = 0; i < 128; i++ ) 9 > f[i] = junk; 10 > } 11 > main() 12 > { 13 > void (*func_tbl[128])(int, int); 14 > fill( func_tbl ); 15 > } In line 9, *f[i] must return an int but junk returns void. In line 14, a similar type mismatch occurs. Try for line 5: void fill( void (*f[])(int, int) ) Unfortunately g++ still dislikes it. Whose c++ are you using? Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp@relay.cs.net) The above opinions are my own. | Why are programmers criticized for If they're also your opinions, | re-inventing the wheel, when car you're infringing my copyright. | manufacturers are praised for it?