Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!seismo!gatech!akgua!whuxlm!whuxl!houxm!ihnp4!cbosgd!cbuxc!cbuxb!cbrma!aka From: aka@cbrma.UUCP (Andy Kashyap) Newsgroups: net.lang.c Subject: Re: pointers to functions Message-ID: <4706@cbrma.UUCP> Date: Tue, 1-Jul-86 13:15:38 EDT Article-I.D.: cbrma.4706 Posted: Tue Jul 1 13:15:38 1986 Date-Received: Fri, 4-Jul-86 09:20:27 EDT References: <237@killer.UUCP> <12187@amdcad.UUCP> Reply-To: aka@cbrma.UUCP (Andy Kashyap(Andy) x5292) Organization: AT&T-BL, RMAS, Columbus Lines: 31 In article <237@killer.UUCP> toma@killer.UUCP (Tom Armistead) writes: >Secondly is it possible to have an array of type 'pointer to' function. >i.e. >int (*function)()[SIZE]; >something like the above, I was able to achieve this using this: >struct fct { > int (*func)(); > } f_array[SIZE]; >function() >{ > int x; > printf("offset: "); > scanf("%d",&x); > (*f_array[x].func)(); >} >Is there another way??? > Yes. Declare as thus: int (*function[SIZE])() ; Set as thus: function[i] = printf ; Invoke as thus: (*function[i])("hello world\n") ; - Andy Kashyap - ..!cbosgd!cbrma!aka