Implement three stacks within an array such that no stack overflows until there is no space left in the entire array space, basically, it uses a integer pointer to manage both the stack and free memory in the array.