www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/12/02:33:05

From: "Nicholas Parker" <NRPARKER AT XTRA DOT CO DOT NZ>
Newsgroups: comp.os.msdos.djgpp
Subject: How do I access elements of a structure with pointers?
Date: Tue, 12 Oct 1999 11:46:12 +1300
Organization: Customer of Telecom Internet Services
Lines: 23
Message-ID: <7ttpdq$97ag8$1@titan.xtra.co.nz>
NNTP-Posting-Host: 210-55-118-151.ipnets.xtra.co.nz
X-Trace: titan.xtra.co.nz 939682042 9677320 210.55.118.151 (11 Oct 1999 22:47:22 GMT)
X-Complaints-To: abuse AT xtra DOT co DOT nz
NNTP-Posting-Date: 11 Oct 1999 22:47:22 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-Mimeole: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This seems a fundamental part of C, but alas I don't know how to do this,
arbitrary code follows;
----------------------------------------
typedef struct {
float re;
float im;
} complex;

void main(void){
complex nick[4];
complex *parker;
parker=&nick[0];

*parker.re=3;   // This line wrong
}
--------------------------------------------

How do I access elements of nick with a pointer is
how do I set parker.re (that is;  nick[0].re ?)

Thanks, Nick.


- Raw text -


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