This is basically dynamic memory allocation with typecasting.
Literal meaning: dynamically allocating memory to _V3Signals, a size of an array of char, being typecasted to a pointer to pointer to _v3signal.
This size is the sizeof a pointer to pointer to _pscsignal times that of (max_v3_signal+PSC_NOMPINS).
Break it down into parts:
1) newchar allocates an array of characters.
2) The number of characters allocated is determined by taking the size of a pointer to a pointer sizeof (_pscsignal **) and multiplying it by (_max_v3_signals + PSC_NOMPINS)
3) The resulting array is cast to a pointer to a pointer to a _v3signal.
4) Which is then stored in _V3Signals.
Sorry for disturbing.Just to verify one last thing.
Is the code above mean
I got a double pointer _V3Signals in type v3signal.
So now assign dynamic memory to the double pointer that will point to array of 10space which are in type v3signal and will store only pointer value?
Please correct me if i am wrong. thanks u very much.
I know both also assign dynamic memory.But what is the diff ?
The same as with type** x = new type*[n]; and x[i] = new type.
First line creates an array of uninitializated (invalid) pointers.
Second line takes one such pinter from array and makes it point to newly created object.
Topic archived. No new replies allowed.
You are using a version without Ads of this website. Please, consider donating: