Hi all,
let's say we have a fixed array:
And now we want to "allocate" (not using "malloc", just take the addresses from this static array) e.g. 5 bytes and save them in some "char*", so that after the allocation:Code:char pool[10000];
Code:char* newArray; . . // Do that allocation (but how?) . newArray[0] = 'a'; // Can be. Allocated address: "&pool[0]" newArray[1] = 'b'; // Can be. Allocated address: "&pool[1]" newArray[2] = 'c'; // Can be. Allocated address: "&pool[2]" newArray[3] = 'd'; // Can be. Allocated address: "&pool[3]" newArray[4] = 'e'; // Can be. Allocated address: "&pool[4]" // newArray[5] = 'x'; CAN'T BE, we have allocated just 5 bytes
So does anybody know how to do that allocation to solve my problem?
Thanks.