Re: init
- From: Marius Huse Jacobsen <loop@xxxxxxxxxxxxx>
- Date: Sat, 25 Feb 2006 17:20:16 +0100
osmium wrote:
<bob@xxxxxxxxxxxxxx> wrote:
>>centerpt[2] + halfwidth/2.0};why won't this work?
float boxcenter[3];
if (nodectr == 0)
boxcenter = {centerpt[0] + halfwidth/2.0, centerpt[1] + halfwidth/2.0,
boxcenter is an array. How does the compiler know which element you are talking about?
He's trying to do the whole array in one setting, see { 0, 1, 2 }
Problem is, that only works when initializing the array;
float boxcenter[3] = { ... }
Other than that you have to do each element separately. At best (AFAIK) that can be automated by a function like
void floatarray ( float* put, float get0, float get1, float get2 ) {
put[0]=get0;
put[1]=get1;
put[2]=get2;
}
Btw, aren't you allocating 4 floats in that array? The case where the last one is not to be used I believe is zero-terminated strings.
(Too long since I've been using arrays, can anyone confirm that?)
.
- References:
- init
- From: bob
- init
- Prev by Date: init
- Next by Date: Re: init
- Previous by thread: init
- Next by thread: Re: init
- Index(es):
Relevant Pages
|