delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/21/04:32:10

From: phreadd AT powerup DOT com DOT au (David Orme)
Newsgroups: comp.os.msdos.djgpp
Subject: pointer problems
Date: 20 May 1997 05:17:19 GMT
Organization: Power Up
Lines: 28
Message-ID: <5lrc4v$gsp$1@grissom.powerup.com.au>
Reply-To: phreadd AT powerup DOT com DOT au
NNTP-Posting-Host: ts2515.powerup.com.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is slightly off topic but please help.


I want to do something like this:
  a->b[i].d[j] = &(a->c[k]);  /* the &() is wrong, I get a sigsev fault */

where "d" is an array of pointers
  and "c" is an aray of integers

How do I make d[j] point to the address of b[k]?

Please don't recommend I abolish "a", although that does make the assignment 
operation simpler (I've done it before, it's b[i].d[j] = &c[k]).

The nested properties of this structure are required for my program as it 
makes the rest of the program simpler, though longer :-)

Thank you for your time,

-- 
+----------------------------------------+
|   David Orme                     \/\   |
|   phreadd AT powerup DOT com DOT au         /\/   |
|   powerup.com.au/~phreadd              |
+----------------------------------------+
|   "Striving for Excellence"            |
+----------------------------------------+

- Raw text -


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