Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site othervax.UUCP Path: utzoo!linus!philabs!micomvax!othervax!scott From: scott@othervax.UUCP (Scott Pace) Newsgroups: net.lang.c Subject: Re: How do I declare... Message-ID: <690@othervax.UUCP> Date: Tue, 27-Aug-85 14:39:58 EDT Article-I.D.: othervax.690 Posted: Tue Aug 27 14:39:58 1985 Date-Received: Thu, 29-Aug-85 21:28:39 EDT References: <368@persci.UUCP> <159@rtp47.UUCP> Reply-To: scott@othervax.UUCP (Scott Pace) Organization: Philips Information Systems - St. Laurent P.Q., Canada Lines: 49 Summary: >> Either I'm missing the perfectly obvious or I've found something >> that's impossible to declare in C, even though it makes sense. >You have discovered a fundamental flaw in C type notation. In essence, >C allows recursive types only in structs, unions, and enums (and I'm not >sure how it would be usefull in enums, so that one can be ruled out for >practical purposes). > >Thus, if you want an array of pointers to arrays of pointers, you can't >do it. Nor can you declare functions returning pointers to functions. Well, our compiler seems to handle these sort of constructs ok:- looking at an array of pointers to arrays of pointers first... int *(*foo1[10])[]; here foo1 is an array of pointers, each pointer pointing to an array of pointers to int's. Thus an integer element might be accessed as follows: *(*foo1[1])[2] and another way might be **foo1[0] now looking at functions returning pointers to functions:- int *(*func1())(); here func is a function returning a pointer to a function, and this function returns a pointer to an int. Thus you could do things like: int *(*func2)(); /*pointer to a function returning a pointer to int*/ int *x; . . . func2 = func1(); x = (func2)(); . . etc. Cheers Scott Pace, ...!philabs!micomvax!othervax!scott (I hope I got all that right!!!)