🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #14547

Re: String array

#14547
From: Luc Kumps
Date: Sun, 28 Jan 2001 20:28
34 lines
1846 bytes
Je kunt een array van string pointers maken als volgt:

int x;
x = 2;
char **stringArray;
stringArray = (char **)malloc(x * sizeof(char *));

char string1[] = "eerste string";
char string2[] = "tweede string";

stringArray[0] = string1;
stringArray[1] = string2;


Luc

"Ward Poelmans" <Ward.Poelmans@wol.be> wrote in message
news:3A747F4F.196D177@wol.be...
> Ik heb een string gemaakt met :   char string[32];
> Nu wens ik een array van die string te maken.
> Maar de string is dan al gemaakt dus kan ik niet char string[x][32];
> x is het aantal strings in die array.
> Hoe doe ik dat? Met malloc of realloc of zoiets?
>
> Ward.
>
> --
> # On the requirements it said: Windows 98 or better - so I installed Linux
>
> # Red hat Linux 7.0 --- Kernel 2.2.16-22 on i586
>   9:19pm  up  1:17,  3 users,  load average: 1.04, 0.52, 0.40
>
>
>
Technical Details
Message-ID: <Vh%c6.293976$MA1.9468419@afrodite.telenet-ops.be>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!193.190.198.17!newsfeeds.belnet.be!news.belnet.be!afrodite.telenet-ops.be!not-for-mail
References: <3A747F4F.196D177@wol.be>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,70ae1e279efefa59
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2001-01-28 12:28:38 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!193.190.198.17!newsfeeds.belnet.be!news.belnet.be!afrodite.telenet-ops.be!not-for-mail
From: "Luc Kumps" <NOkumpsSPAM@pandora.be>
Newsgroups: be.comp.programming
References: <3A747F4F.196D177@wol.be>
Subject: Re: String array
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <Vh%c6.293976$MA1.9468419@afrodite.telenet-ops.be>
Date: Sun, 28 Jan 2001 20:28:37 GMT
NNTP-Posting-Host: 195.130.154.252
X-Complaints-To: abuse@pandora.be
X-Trace: afrodite.telenet-ops.be 980713717 195.130.154.252 (Sun, 28 Jan 2001 21:28:37 MET)
NNTP-Posting-Date: Sun, 28 Jan 2001 21:28:37 MET
Organization: Telenet Internet