Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

returning vector from function

Status
Not open for further replies.

Maurader

Technical User
May 8, 2002
59
CA
what is the syntax for returning a vector from a fuction? is it even possible?

thx!!!!
 
Of course...

int *returnVector(int &dimension) {
dimension = 100;
int *ret = new int[dimension];
return ret;
};

you will have in <dimension> the vector's dimension and in the return value, an array of integers. [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
I am not sure what this code says...
does it say, return a pointer to an int? and if so, how does that translate to a vector?
and ret is also a pointer to an array of dimension ints?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top