I have a variable **foo which I let user to initialize to foo[x][y]. Now, the problem is that how to change that size in the fly so, in example, when I first have foo I would later have foo. I could of course use another variable for swapping but I'm thinking of sizes like foo so that would be a real memory eater (though, even without the temporary variable).
I've been thinking of linked lists, but that would be slow and still eats lots of memory. Any ideas?