new in pawno, help
#4

The ampersand (&) means that a variable is passed "by reference" which means the function can alter the original variable. Unlike variables that are passed "by value" (the default) where - in a sense - a copy of the original variable is sent instead. For example:
PHP Code:
main()
{
    new 
byref;
    
printf("%d"byref); // prints 0
    
DoSomethingWithByRef(byref);
    
printf("%d"byref); // prints 5
}

DoSomethingWithByRef(&value)
{
     
value 5;

In the case of strtok, the idx (index) variable stores the position where a space was encountered. So if strtok is called again with the same idx parameter (which now does have a value) it will start its search from that position onward. However, strtok is horribly outdated. Don't use it. Use sscanf instead.
Reply


Messages In This Thread
new in pawno, help - by fiha4155 - 16.06.2017, 02:33
Re: new in pawno, help - by Vince - 16.06.2017, 09:11
Re: new in pawno, help - by fiha4155 - 17.06.2017, 16:54
Re: new in pawno, help - by Vince - 17.06.2017, 18:29
Re: new in pawno, help - by DRIFT_HUNTER - 17.06.2017, 19:50
Re: new in pawno, help - by OneDay - 18.06.2017, 07:08
Re: new in pawno, help - by fiha4155 - 18.06.2017, 11:09
Re: new in pawno, help - by Dayrion - 18.06.2017, 11:14
Re: new in pawno, help - by fiha4155 - 18.06.2017, 11:26
Re: new in pawno, help - by DRIFT_HUNTER - 18.06.2017, 11:49
Re: new in pawno, help - by fiha4155 - 18.06.2017, 11:55
Re: new in pawno, help - by BigETI - 18.06.2017, 18:21

Forum Jump:


Users browsing this thread: 1 Guest(s)