dev_15 <na************@googlemail.comwrites:
Hi, I'm going through some code and thought that this allocates an
array of structs but its supposed according to comments to allocate an
array of pointer to structs. What does it actually do
ptrLogArray = new structDisplayLogData *[iCount];
It behaves as per the comments. What follows 'new' is, syntactically,
a declaration with the name missed out. If you declared this array
you'd write:
structDisplayLogData *an_array_of_ptrs_to_structs[iCount];
now just remove the name and add 'new':
new structDisplayLogData *[iCount];
If you thought
structDisplayLogData *array[iCount];
should mean:
structDisplayLogData (*array)[iCount];
(i.e. a pointer to an array of structs) rather than what it *does* mean:
structDisplayLogData *(array[iCount]);
(an array of pointers) then you need to study the syntax a bit more.
--
Ben.