Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: on understanding & and pointer arithmetic Date: Thu, 16 Dec 2021 12:44:43 -0800 Organization: None to speak of Lines: 31 Message-ID: <87ee6c8ekk.fsf@nosuchdomain.example.com> References: <86a6h0eiy9.fsf@levado.to> <865yrod2cx.fsf@levado.to> <87h7b8wind.fsf@bsb.me.uk> <86ee6c9w1a.fsf@levado.to> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="20ffafaec83dfe7e814f2bd671a6cef3"; logging-data="24065"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+NfcN8OWw6zrZelJtBp+3C" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:8xeGX5NqKSzAmiStVJUk1o7Tp1g= sha1:MfckUsM01OFnXx/y/J503BLMEWg= Xref: csiph.com comp.lang.c:163880 Meredith Montgomery writes: [...] > Thanks for the correction. I'll repeat what you say in my words just to > get a chance that you might verify what I'm saying. When I have an > array such as > > char a[] = "hello, world" > > which occupies 13 bytes, then a pointer to it is a pointer of type > > char (*a)[13] > > and that's how we write its type --- although I could omit the letter a > there, perhaps I should, I also think it's okay to write it there. Bart > effectively wrote (char*)[], which is not the same or perhaps not a > valid type at all. That's my understanding now. [...] The name "a" is not something you can arbitrarily decide to include or omit. `char (*)[13]` is a type name (pointer to array of 13 chars). `char (*a)[13];` not a type name. It's a declaration. It declares an object named `a` of type `char (*)[13]`. (And it needs that trailing semicolon.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */