Gamestudio Links
Zorro Links
Newest Posts
Training with the R bridge does not work
by frutza. 11/19/25 22:32
ZorroGPT
by TipmyPip. 11/19/25 10:10
MRC.c and WFO
by 11honza11. 11/18/25 15:22
webGL
by Ice2642. 11/17/25 21:27
Camera always moves upwards?
by NeoDumont. 11/17/25 09:56
Future of ZorroHFT
by TipmyPip. 11/16/25 13:52
COT Download with Quandl does not work
by Petra. 11/15/25 09:35
Zorro 2.70
by jcl. 11/15/25 08:43
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, Quad), 7,176 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
SkinnyApe, tritom, sheliepaley, Blueguy, blobplayintennis
19179 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