Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!att!cbnewsd!tainter From: tainter@cbnewsd.ATT.COM (johnathan.tainter) Newsgroups: comp.lang.c Subject: Re: type *var -- vs. -- type* var Message-ID: <1688@cbnewsd.ATT.COM> Date: 11 Sep 89 23:45:53 GMT References: <12813@pur-ee.UUCP> Reply-To: tainter@cbnewsd.ATT.COM (johnathan.tainter,ih,) Organization: AT&T Bell Laboratories Lines: 23 In article <12813@pur-ee.UUCP> lewie@ecn-ee.UUCP writes: >Regarding declarations of pointers x, y and z, and question of why >'int* x, y, z' doesn't do what's 'intuitive': >> (int *) x, y, z >'(int *) x' is a cast, not a declaration. Compiling the above yields >errors about x, y and z being undeclared. Because there's no explicit >separator between declarations and statements, you'll never be able >to declare pointers as such. Isn't C syntax fun? This is a place where typedef is not equivalent to a macro. typedef int *Pointer_to_int; Pointer_to_int x, y, z; does exactly what was desired with only one side effect, it defines a typedef. Don't try and use a screwdriver as a chisel, especially when you already have the chisel. >Jeff Lewis (lewie@ee.ecn.purdue.edu, pur-ee!lewie) --johnathan.a.tainter-- att!ihlpb!tainter