www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/20/21:32:25

From: ville DOT sjoberg AT swipnet DOT se (Ville Sjoberg)
Newsgroups: comp.os.msdos.djgpp
Subject: quest: initializing many structs
Date: Fri, 21 Feb 1997 00:38:00 GMT
Organization: -
Lines: 39
Message-ID: <5ehr3s$3s3@mn5.swip.net>
NNTP-Posting-Host: dialup120-8-5.swipnet.se
NNTP-Posting-User: s-222948
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is perhaps more of a C question than a DJGPP one, but I hope
someone out there will have mercy and answer it anyway...

I'm having trouble setting the initial parameters for a cube. From the
code below, it should be obvious what I'm trying to do. What is the
proper way of doing this in C?

struct pointstruct
{
	int x,y,z;
};

struct cubestruct
{
	struct pointstruct point[1][1][1];
};

void cube_init (struct cubestruct *cube)
{
	cube->point[0][0][0] = {-1, -1, -1};
	cube->point[0][0][1] = {-1, -1, +1};

	cube->point[0][1][0] = {-1, +1, -1};
	cube->point[0][1][1] = {-1, +1, +1};
	
	cube->point[1][0][0] = {+1, -1, -1};
	cube->point[1][0][1] = {+1, -1, +1};

	cube->point[1][1][0] = {+1, +1, -1};
	cube->point[1][1][1] = {+1, +1, +1};
};

----------------------------------------------
Vilhelm "Ville" Sjoeberg
Sci-fi geek, paranoid cyberpunk, celloplayer
PGP key available at www.villeweb.home.ml.org
"The future is not what it used to be."


- Raw text -


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