Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: technology discussion =?utf-8?Q?=E2=86=92?= does the world need a "new" C ? Date: Tue, 09 Jul 2024 16:50:06 -0700 Organization: None to speak of Lines: 30 Message-ID: <87plrmw2fl.fsf@nosuchdomain.example.com> References: <871q48w98e.fsf@nosuchdomain.example.com> <87wmlzvfqp.fsf@nosuchdomain.example.com> <87h6d2uox5.fsf@nosuchdomain.example.com> <20240707164747.258@kylheku.com> <877cdur1z9.fsf@bsb.me.uk> <20240709152805.587@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 10 Jul 2024 01:50:07 +0200 (CEST) Injection-Info: dont-email.me; posting-host="2ff96a67704e58776cf4f9c1dffac965"; logging-data="1669484"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HuE9JFbD+e6C7W8BT2tBl" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:s1ETpsLvA8DLBuOUkReGdMKSGms= sha1:/jsWLsT5w7gpG8MfdP9Eukks3BE= Xref: csiph.com comp.lang.c:386969 bart writes: [...] > Arrays can be passed by explicit reference: > > void F(int(*A)[20]) { > printf("%zu\n", sizeof(*A)/sizeof((*A)[0])); // shows 20 > } > > That can be called like this: > > int a[20]; > F(&a); On the language level, that's passing a pointer to an array object. The pointer itself is passed by value. Passing a pointer to an array is conceptually no different than passing a pointer to anything else. C has pass-by-reference in exactly the same way that it has linked lists. It has neither as a language feature, but both can be emulated using pointers. And you can't really understand how C handles arrays if you start by asserting that they're "passed by reference". But you just have to make it seem more complicated than it really is. [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */