Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 03/06/26 07:18
zorro with ccxt?
by opm. 03/03/26 03:17
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (TipmyPip), 5,463 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 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