The Dink Network

Reply to Re: On the other hand...

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
January 31st 2003, 11:11 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
: : But what about declaring pointers to a heap so you can make your own '&story' for example

: Well, in DinkC, variables are not reference parameters like in C++. Every variable in DinkC should have an ampersand (& . You can't do something simple like this:

: void change(float &x, float &y)

: { float w = x;

:  x = y;

:  y = w;

: }

: That's C++, but int DinkC every variable, global or local, should have an &. To create a local variable in a script, you can do:

: int &_a;

: Local variables can only be used in that script, globals can be used anywhere. To create a global variable, we usually create them in main.c:

: make_global_int("&story", 0);

: DinkC is a simple language and many things common in C++ can't be done in DinkC. Also, you can't include other files like .h files, DinkC scriptfiles are .c and they can be compiled to .d but that's not necessary.

You can't have unlimited variables, however. You can have about 250 (more or less) globals. You can't go over this number with local variables either, if they're used simultaneously.