Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connectionsPath: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: comp.lang.c Subject: "array" Date: 2 Apr 2025 11:01:01 GMT Organization: Stefan Ram Lines: 59 Expires: 1 Mar 2026 11:59:58 GMT Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de jGMNT7AqJkGADxOb73ZU3wkV/2s7+/L2yTbi39VhG00hJU Cancel-Lock: sha1:MX40azWVLMfn0vjipLg1VFzwNno= sha256:09BGYdMg42hhHkaJxlFjnyDSjKS4u7RO8ryF1/MZehU= X-Copyright: (C) Copyright 2025 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: en-US Bytes: 3157 Below, an array is allocated dynamically. #include #include int main( void ) { char *array_pointer = malloc( 10 * sizeof *array_pointer ); if( !array_pointer )return EXIT_FAILURE; *array_pointer = 'a'; free( array_pointer ); } But is it really an array according to the C spec? C only defines "array type", not array, but it uses ISO/IEC 2382:2015 as a normative reference, and ISO/IEC 2382:2015 says: |array |An aggregate that is an instance of an array type and each |element or appropriate group of elements in which may be |referenced randomly and independently of the others. ISO/IEC 2382-15 (1998), 15.03.08 (Can't access newer versions!) . That block of memory that malloc allocated, does it have an array type? I'm not sure. So are we allowed to call it an array? I think the C community /would/ mostyly call this an array. Here's an attempt to give it an explicit array type: #include #include int main( void ) { char( *array_pointer )[ 10 ]= malloc( sizeof *array_pointer ); if( !array_pointer )return EXIT_FAILURE; ( *array_pointer )[ 0 ]= 'a'; free( array_pointer ); } Is it now more of an array than before? In n3467: |The effective type of an object that is not a byte array, for |an access to its stored value, is the declared type of the |object. 83) from 6.5p6 |83) Allocated objects have no declared type. footnote for 6.5p6 |For all other accesses to a byte array, the effective type of |the object is simply the type of the lvalue used for the access. from 6.5p6 In my example programs, the lvalue for the access has the type "int". So, I can see that there's an int object, and - in a similar way - that there are other int objects behind it, but not necessarily that they form an array.