Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: usecases of void foo(char **b) {} Date: Wed, 02 Nov 2016 13:37:40 -0700 Organization: None to speak of Lines: 46 Message-ID: References: <2bf83e98-eb96-4ab6-b1ca-4e6a8bd824f5@googlegroups.com> <5b33a608-8f61-4ea0-be08-080018f5772c@googlegroups.com> <87mvhjo3jw.fsf@bsb.me.uk> <3a09f5ec-d4f7-40fa-9855-b5c3f02ce4e9@googlegroups.com> <87ziljks6k.fsf@bsb.me.uk> <2199a2dd-d844-4f8d-bfe0-6a7c2854277b@googlegroups.com> <87twbqlsin.fsf@bsb.me.uk> <87oa1yljof.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="55d562a779fc0ae2b1f2a983cf45db85"; logging-data="7665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xi0lqsCV82dEQwLnlwzZo" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:OErzgTHa7v0M7oyCfYtQNk0sVJ8= sha1:WO7aM4PYYAOBE3xWe8iK0yY+K3w= Xref: csiph.com comp.lang.c:95620 BartC writes: > On 02/11/2016 19:55, Keith Thompson wrote: >> BartC writes: >>> I was suggesting they are used for the same ends. >> >> Given what declaration of A? Or do you need to change how A is defined? >> >> Once again, you cannot in general understand an expression without >> seeing the relevant declarations. > > Someone finally sees the problem! Huh??? Several of us have said numerous times that you cannot in general understand an expression without seeing the relevant declarations. You're the only one who seems to think it's a problem. > I was wondering whether to qualify my statement as to what kind of A it > might be, but I saw I'd already done so in my reply to Ben: > > > Yes, exactly that. Or at least when the A in A[i] is a pointer to > > array element. > > Do I need to repeat the other stuff I said there? You want to allocate a > dynamic array, you have these choices: > > int* A = malloc(...) > int (*A)[] = malloc(...) > > Element access is with A[i] or with (*A)[i]. > > In both cases, you want a dynamic array, and you want to index elements > of that array, and you have these two choices. Both work just as well > except one has more fiddly syntax, especially the parentheses. So there's more than one way to do something, and one of them is more convenient than the other. And somehow this is a problem. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"