void int_to_hex(int *dez,string& hex_string);
Agni
Practically a Master Poster
655 posts since Dec 2007
Reputation Points: 431
Solved Threads: 116
A simple example demonstrating a string passed by reference:
void func(string &s)
{
s += " something.";
}
This is just a useless function which adds " something." at the end of the string passed to the function, but it demonstrates the use of references.
A call to this function would look like:
string str = "This is";
func(str);
After running the function,str will contain: This is something. .
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
>It does work, but whats with this warnings ?
According to what I think, your program is bigger than that what you've posted, so could you please post the whole code so we can take a look at it?
The example in your post should compile fine without any warnings.
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243