Re: init
- From: "toby" <toby@xxxxxxxxxxxxxxxxxxx>
- Date: 25 Feb 2006 10:48:20 -0800
Marius Huse Jacobsen wrote:
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...
Or a macro.
Btw, aren't you allocating 4 floats in that array?
No.
The case where the
last one is not to be used I believe is zero-terminated strings.
You are probably thinking of a case where an array size is implied,
such as:
char a[] = "foo";
Where the array is sized to 4 chars to match its string constant
initialiser (including an implicit NUL).
(Too long since I've been using arrays, can anyone confirm that?)
.
- Prev by Date: Re: init
- Next by Date: Re: init
- Previous by thread: Re: init
- Next by thread: Re: init
- Index(es):
Relevant Pages
|