[OT] C-Frage

Jan-Benedict Glaw jbglaw at lug-owl.de
Thu Feb 20 15:09:13 CET 2003


On Thu, 2003-02-20 15:00:13 +0100, Florian Lohoff <flo at rfc822.org>
wrote in message <20030220140013.GA21810 at paradigm.rfc822.org>:
> On Thu, Feb 20, 2003 at 10:11:55AM +0100, Jan-Benedict Glaw wrote:
> > Hallo .*!
> > 
> > ---------------------------
> > #include <stdio.h>
> > #include <stdlib.h>
> > #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
> > 
> > static unsigned char a[] = {
> >         "ASD"[1],
> >         "Hello"[3],
> > };
> 
> Hier wird ein array unbestimmter groesse kreiert ...
> D.h. in wirklichkeit ist doch a dann ein
> char ** oder ?

Nein. Ich creiere ein Array, das exakt zwei Werte beinhalten soll:

a[0] == 'S';
a[1] == 'l';

> Da das dingen "unbestimmt" in der groesse ist sollte
> sizeof nicht funktionierten ...

Das ist nicht das Problem, Du hast das Array falsch aufgefaßt.

> static char a[] = {
> 	"Hallo",
> 	"Du"
> 	NULL,
> };

Das ist nicht, was ich wollte:-) Zudem müßte is imho 'static char *a[]'
heißen. Du gibt als initializer ein array von pointern mit auf den
Weg...

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw at lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur
    fuer einen Freien Staat voll Freier Bürger" | im Internet!
   Shell Script APT-Proxy: http://lug-owl.de/~jbglaw/software/ap2/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lug-owl.de/pipermail/linux/attachments/20030220/6c192db7/attachment.sig>


More information about the Linux mailing list