Difference with "static" and "new"
#8

pawn Код:
main()
{
    for (;;)
    {
        new value;
        printf("old value: %d", value); // always 0
        value = random(10000);
        printf("new value: %d", value);
       
        sleep(1000);
    }
}
pawn Код:
main()
{
    for (;;)
    {
        static value;
        printf("old value: %d", value); // not lost unlike with "new"
        value = random(10000);
        printf("new value: %d", value);
       
        sleep(1000);
    }
}
Reply


Messages In This Thread
Difference with "static" and "new" - by Luis- - 05.03.2014, 16:38
Re: Difference with "static" and "new" - by Konstantinos - 05.03.2014, 16:53
Re: Difference with "static" and "new" - by Kyle - 05.03.2014, 16:57
Re: Difference with "static" and "new" - by newbienoob - 05.03.2014, 17:00
Re: Difference with "static" and "new" - by Luis- - 05.03.2014, 17:18
Re: Difference with "static" and "new" - by Konstantinos - 05.03.2014, 17:23
Re: Difference with "static" and "new" - by AndreT - 05.03.2014, 17:32
Re: Difference with "static" and "new" - by Djole1337 - 05.03.2014, 17:44

Forum Jump:


Users browsing this thread: 1 Guest(s)