variable is destroyed?
#1

Hi,

When i create variable for example in function

Код:
stock anyfunctioname()
{
   new anystringgg[ 100 ];
   format( anystringgg, 99,"blablabla");

   SendClientMessageToAll(-1,  anystringgg );
}
So anystringgg is automatic destroyed after function ends?
Reply
#2

No it's not.. It carries the string within it until the function is used again...
Reply
#3

So just 1 new anystringgg[ 100 ]; is created, No matter how many times function is called?
Reply
#4

Rubbish. Local variables are destroyed when the function ends unless they are declared static.
Reply
#5

Exactly as Vince said, otherwise there wouldn't be a big difference between local and global vars.

It gets created when function is called, and destroyed when its done.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)