weird code.
- From: "syn1kk" <TrevorBoydSmith@xxxxxxxxx>
- Date: 23 Aug 2006 10:55:10 -0700
1: float (*data)[16384];
2: data = malloc(31 * sizeof(data[0]));
3: data[i][j] = VARIABLE;
Question 1: The variable data is a float pointer?
Question 2: When the [16384] is used. Does that mean it is an array of
float pointers? What does it mean?
Question 3: Or does it mean that there are 16384 floats allocated with
the pointer data that points to the head of those 16384 floats?
Question 4: It will malloc 31*16384 floats... I assume this is true
based on how the program uses it. But shouldn't it be mallocing
31*sizeof(float*)?
Question 5: Then the code starts using data as a multidimensional
array. When did it become a multidimensional array?! and how did it
become multidimensional?!
.
- Follow-Ups:
- Re: weird code.
- From: Eric Sosman
- Re: weird code.
- From: jmcgill
- Re: weird code.
- From: "Nils O. Selåsdal"
- Re: weird code.
- Prev by Date: Re: Is it legal?
- Next by Date: Re: How to catch a user interruption?
- Previous by thread: Hash function for float.
- Next by thread: Re: weird code.
- Index(es):
Relevant Pages
|