www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/26/01:58:59

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Zero length array ?
Date: Tue, 25 Feb 1997 08:48:18 -0800
Organization: Alcyone Systems
Lines: 25
Message-ID: <331317D2.2DD1AF00@alcyone.com>
References: <33133A4B DOT 1571 AT post DOT comstar DOT ru>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Dim Zegebart wrote:

> typedef struct
> { int hName;
>   char szName[0];
> } TFoo;
    ...
> My question is : then I allocate space for MyFoo where actualy
> MyFoo->szName points ?

What you are trying to do is create variable-language records, which is not
a good idea in C.

You cannot created zero-length arrays.  This makes no conceptual sense
whatsoever in C.

-- 
       Erik Max Francis, &tSftDotIotE / email:  max AT alcyone DOT com
                     Alcyone Systems /    web:  http://www.alcyone.com/max/
San Jose, California, United States /    icbm:  37 20 07 N  121 53 38 W
                                   \
              "I am become death, / destroyer of worlds."
                                 / J. Robert Oppenheimer (quoting legend)


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019