Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!uw-beaver!tektronix!cae780!hplabs!hpcea!hpda!hpirs!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.lang.c Subject: Re: Why pass structs? (not struct pointers) Message-ID: <2550007@hpisod2.HP.COM> Date: Tue, 3-Mar-87 17:49:27 EST Article-I.D.: hpisod2.2550007 Posted: Tue Mar 3 17:49:27 1987 Date-Received: Sat, 7-Mar-87 05:04:34 EST References: <3346@cisunx.UUCP> Lines: 33 The example I provided to demonstrate a syntax for array lvalues incorrectly included several declarations for items which should have been "char" instead of "int". Here's the example again, corrected. Dave Decot hpda!decot #define ARRSIZ 20 main () { char (reverse())[ARRSIZ]; /* function returning array [ARRSIZ] of char */ char arr[ARRSIZ] = "this is amazing"; arr[] = reverse(arr[]); printf("%s\n", arr); } char (reverse(s))[ARRSIZ] char s[ARRSIZ]; { char tmp[ARRSIZ], *tp = tmp; int i; for (i = strlen(s)-1; i >= 0; i--) *tp++ = s[i]; *tp = '\0'; return tmp[]; }