delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/12/02:15:05

Message-ID: <37118BF9.C245F41@accord-soft.com>
Date: Mon, 12 Apr 1999 11:30:25 +0530
From: Sunil V <sunilv AT accord-soft DOT com>
Organization: Accord Software & Systems Pvt. Ltd.
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com, CORNU DOT Nicolas AT wanadoo DOT fr
Subject: Re: typedef struct problem
References: <7eq472$nor$1 AT wanadoo DOT fr>
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.
--------------6A275222167B166A0DE172BD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,
I think u might have typedefined as pointer to structure. Hence mystruct->x
or mystruct->substruct will work(where x and substruct are elements of
mystruct).  If substruct is a pointer to the structure inside a primary
structure then it should work. Otherwise u have to use
    mystruct->substruct.data.

e.g.

typedef struct
{
    int i;
    struct
    {
        int data;
    }substruct1;
    struct
    {
        int data;
    } *substruct2;

}MYSTRUCT;

MYSTRUCT *mystruct1;
MYSTRUCT mystruct2;

mystruct1->substruct1.data - valid.
mystruct1->i - valid
mystruct2->i - invalid.
mystruct1->substruct1->data - invalid.
mystruct1->substruct2->data - valid.

I hope this will answer u'r Q. If not sent the structure definition u are
using.

Regards Sunil

"CORNU.Nicolas" wrote:

> i 've got a typedef structure, i can access to the first
> elements of the struct (in a function) but when i declare sub structure
> in the primary structure, i've got error:
>
> by:     mystruct->substruct->data
> i've got an error:     -> is not valid
>
> if i use first elements of struct i haven't got any errors, that's work
> fine.
>
> thanks
>
> --
> CORNU Nicolas
> E-mail: CORNU DOT Nicolas AT wanadoo DOT fr
> ICQ: 31463000
> Homepage: http://perso.wanadoo.fr/nicolas.cornu/Index.htm

--
_______________________________________________________________________

The only place where you get success before work is in your dictionary.
_______________________________________________________________________


--------------6A275222167B166A0DE172BD
Content-Type: text/x-vcard; charset=us-ascii;
 name="sunilv.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Sunil V
Content-Disposition: attachment;
 filename="sunilv.vcf"

begin:vcard 
n:V;Sunil
tel;home:341 4609
tel;work:556 0136 / 138 / 105
x-mozilla-html:FALSE
org:Accord Software & Systems Pvt. Ltd.;Software Division
adr:;;;;;;
version:2.1
email;internet:sunilv AT accord-soft DOT com
x-mozilla-cpt:;-3328
fn:Sunil V
end:vcard

--------------6A275222167B166A0DE172BD--

- Raw text -


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