Reading in data and putting it in an array

Hello, I need to read in data from a file and store it in an array. I however need to keep my array of an unspecified size until I start reading it in. I want to create a function and have my array be the return value of this function.

How do I call my function so that I keep the array size unspecified until I'm inside the function?

Well, you could cheat and use an std::vector instead of an array, BUT when they said array they probably meant array, so...
http://cplusplus.com/doc/tutorial/dynamic/

See if that helps! :)

-Albatross
So the idea with that is that I basicly create an array of size 0, then I add to it with "array= new (nothrow) int[i]" i elemetns? Cool.

Still, how do I do the function?

_____ func(inputs)
{
...
return ____;
}

What do I put in those spaced? Do they need sizes?
Topic archived. No new replies allowed.