I've had this problem before, and probably the best bet is you have to manage the array inside the struct itself (as sizeof() doesn't work correctly in Lite-C as it does in C/C++). Something like:
Code:
#define    SIZE    1000
typedef struct {
int member[SIZE];
} Object;

Object *ptr = (Object *) sys_malloc( sizeof(Object) + (SIZE * sizeof(int)) );
<...>
sys_free(ptr);



Edited, just checked the manual and it says:
Quote:
Arrays are internally treated as a pointer to a memory area. So, sizeof(any_array) always equals to 4 because that is the size of a pointer.


So wherever you defined your arrays as int i[4]; or int *i; it will have the same internal layout, and thus must be managed manually.

By the way int main() is a far more better practice.

Last edited by Florastamine; 12/08/15 09:02.