Article View: comp.std.c
Article #974Re: C question (memory allocation and access)
From: Peter da Silva
Date: Thu, 16 Nov 1989 17:56
Date: Thu, 16 Nov 1989 17:56
17 lines
916 bytes
916 bytes
How about this:
union padding {
int mn[2];
double d;
};
block = malloc(sizeof (union padding) + whatever * sizeof (double));
((int *)block)[0] = m;
((int *)block)[1] = n;
start_of_double_array = &((union padding *)block)[1];
--
`-_-' Peter da Silva <peter@ficc.uu.net> <peter@sugar.hackercorp.com>.
'U` -------------- +1 713 274 5180.
"vi is bad because it didn't work after I put jelly in my keyboard."
-- Jeffrey W Percival (jwp@larry.sal.wisc.edu)
Technical Details
Message-ID:
<7008@ficc.uu.net>Path:
arc1-ca.pugleaf.net!utzoo!censor!becker!geac!jtsv16!uunet!ficc!peterReferences:
<5322@wpi.wpi.edu> <20771@mimsy.umd.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!becker!geac!jtsv16!uunet!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.std.c Subject: Re: C question (memory allocation and access) Keywords: memory access Message-ID: <7008@ficc.uu.net> Date: 16 Nov 89 17:56:42 GMT References: <5322@wpi.wpi.edu> <20771@mimsy.umd.edu> Reply-To: peter@ficc.uu.net (Peter da Silva) Distribution: usa Organization: Xenix Support, FICC Lines: 17