Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,633 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Global/Local/Undim/Array of Pointer? #128436
05/07/07 02:43
05/07/07 02:43
Joined: Jul 2005
Posts: 34
Hong Kong
U
ultranet Offline OP
Newbie
ultranet  Offline OP
Newbie
U

Joined: Jul 2005
Posts: 34
Hong Kong
I know variables defined outside functions are global and those inside functions are local. But lite-C does not have the key words GLOBAL and LOCAL just like BASIC to define variables? That can be a little bit inconvenient.

And Lite-C does not have the ability to free unused arrays? In BASIC, arrays can be undimed to free the memory. That means if I have defined thousands of arrays and once they are not needed, they are just there to occupy the memory. That cause difficulties to manage resources/memory.

What are the alternatives to do these things in lite-C?

And one more question...
Can pointers be defined as arrrays?

Thanks.

Re: Global/Local/Undim/Array of Pointer? [Re: ultranet] #128437
05/07/07 04:03
05/07/07 04:03
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline

Serious User
TWO  Offline

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
Some demonstration:

Code:

var Honolulu; // Global

void main()
{
var Hamburger; // Local, on the stack -> killed when the function gets terminated

SomeClass* Instance = (SomeClass*)malloc(sizeof(SomeClass)); // Local, in the memory -> you have to free this yourselfe

free(Instance); // Free memory

void* Lala[10]; // Pointer array
int* Lulu[10];
}




Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1