Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Akow, tomaslolo), 738 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 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 | chip programmers | 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