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 connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <4Z6dnTcuH5c_tU37nZ2dnZfqn_qlxKTP@brightview.co.uk>
Deutsch   English   Français   Italiano  
<4Z6dnTcuH5c_tU37nZ2dnZfqn_qlxKTP@brightview.co.uk>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 29 Aug 2024 07:52:02 +0000
From: Mark Summerfield <mark@qtrac.eu>
Subject: Re: is it possible to point to a slice of an array without malloc or
 VLAs?
Newsgroups: comp.lang.c
References: <NS2dnaQtUKseUVP7nZ2dnZfqn_WdnZ2d@brightview.co.uk>
	<vamm7j$3d74u$1@dont-email.me>
MIME-Version: 1.0
User-Agent: Pan/0.154 (Izium; 517acf4)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <4Z6dnTcuH5c_tU37nZ2dnZfqn_qlxKTP@brightview.co.uk>
Date: Thu, 29 Aug 2024 07:52:02 +0000
Lines: 24
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-OxF7g7+xxMKt0kSgUztHeqxVKM5FVRkwk2LYMypJjIMvnjEihk4mSphRnY8YZb7Ji+weBKFqIYm9mvr!bwgARSsG2n03VF+AVcPhPkQPcdwPA3rLKe/gNYRJU+sPPt+KZZxFEzy3vwtdiU7H4yrdfzitoxI+!t6HbZ7d4YbHePjN1pLjpch+yIg==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
Bytes: 1785

On Wed, 28 Aug 2024 09:13:39 +0100, Phil Ashby wrote:
[snip]
> To answer the specific question, I would use pointer arithmetic,
> provided there is no intention to modify values, ie:
> 
> 	char **slice = argv + config->optind;
> 
> thus slice now points at the appropriate part of argv and can be indexed
> or dereferenced / incremented to access elements.
[snip]

Thank you, that works great. I now do that plus store the slice's size using:
argc - optind

I tried to get the size using

#define ARRAYSIZE(a) (&(a)[1] - (a))

char **folders = argv + optind;
int num_folders = argc - optind;
int size = ARRAYSIZE(folders);
printf("%d %d\n", num_folders, size);

but size was always 1.