Actually, the & in a declaration like that is a reference, not the address of operator. Kinda confusing shared syntax ;) What you told him to do is correct though, I am just nit-picking :D
int i = 1; int &r = i; // r is a reference to i int *p = &i; // p is a pointer to i // All of these print 1 cout << "i =" << i << endl; cout << "r=" << r << endl; cout << "*p=" << p << endl; // This prints a memory address cout << "p=" << p << endl; Rob At 03:33 PM 05/10/2002 +0200, you wrote: >Vyacheslav - > >try: > >char szMes[25]; >void ReturnTestString(char* szSring, int Id); >ReturnTestString(szMes, 1); > >the '&' sign before a variable name means "address-of the variable." when >declaring the function, the name szString is just the name of the variable >inside the function. ReturnTestString just needs to know the variable is a >string, which is char*. btw, putting a * after a type (like char*) means >the variable is a pointer to that type. for more info, check out: > >http://www.cplusplus.com/doc/tutorial/tut3-2.html (about strings) >http://www.cplusplus.com/doc/tutorial/tut3-3.html (about pointers) > > >hope this helps, > >barret > > > >----- Original Message ----- >From: "Vyacheslav Djura" <[EMAIL PROTECTED]> >To: "barret" <[EMAIL PROTECTED]> >Sent: Saturday, October 05, 2002 3:18 PM >Subject: Re[2]: [hlcoders] returning string > > > > Hello barret, > > > > Saturday, October 5, 2002, 3:56:48 PM, you wrote: > > > > b> hi - > > > > b> i did something similar, but i used: > > > > b> char szMes[25]; //need szMes to be a string, not a char. in this case >an > > b> array of chars. > > b> //25 is just my guess for how big it can >get > > Then, how to write header of this function (char* &szSring,int Id) so > > array will be fixed (25) ? > > I am not good at C++'s "*" > > and "&"? > > > > thanks... > > > > -- > > Best regards, > > Vyacheslav mailto:[EMAIL PROTECTED] > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, >please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > >_______________________________________________ >To unsubscribe, edit your list preferences, or view the list archives, >please visit: >http://list.valvesoftware.com/mailman/listinfo/hlcoders Rob Prouse (Commando) Tour of Duty Mod http://www.tourofdutymod.com _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

