|
| devas (6) | |
| hi, i have some diffuculties in understanding a sample code: #define MAX 32 #define MIN 1 #define NUMBER_OF_CARD MAX*MIN typedef float BUFFER[NUMBER_OF_CARD]; typedef float *BUFFER_PTR; BUFFER AO_BUFFER; BUFFER_PTR ptrBuffer = AO_BUFFER; ok, Does this code sample mean the line below: float *ptrBuffer = float[32]; i think it doesn't mean. so can anyone explain me what does it mean? Question 2: i have a class and there is a pointer as a private member. class A { public: A(); virtual ~A(); private: float *m_ptrValue[32]; }; how can i initialize m_ptrValue? i couldn't initialize it. i wrote a function and i've tried to initialize it like below: m_ptrValue[32] = new float[32]; but i had compile time errors. thanks for help. | |
| Chewbob (95) | |||||
To answer your first question, the code basically says this:
ptrBuffer points to the first element in AO_BUFFER. Secondly, m_ptrValue is going to be a 2D array. You need to allocate each pointer like this:
And then you need to free each one when you've finished with it. | |||||
Last edited on | |||||
| devas (6) | |
| thanks a lot :) | |
This topic is archived - New replies not allowed.
