[REP++] Returned arrays
#1

Can someone tell me how can i access a returned array from a function?

Thanks.
Reply
#2

From my understanding, arrays are passed by as reference always. Either way if you meant something like GetPlayerName function to return the the name instead of referencing it, then it's the same thing as returning any other array.

Code:
main()
{
   new mainstring[128];
   format(mainstring, sizeof(mainstring), "%s", funketup());
   printf("%s is same as %s", mainstring, funketup());
}

funketup()
{
   new str[128] = "'this is a returned string";
   
   format(sizeof(str), "%s and we do something naw with it %i'", GetTickCount());

   return str;
}
Meaningless example, hope that clears shit up.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)