Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, degenerate_762), 1,213 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
var pointers #297080
11/04/09 22:54
11/04/09 22:54
Joined: Nov 2009
Posts: 34
S
Sepiantum Offline OP
Newbie
Sepiantum  Offline OP
Newbie
S

Joined: Nov 2009
Posts: 34
If i were to declare a pointer to a variable, how would I do it?
I know in ANSI C you do it like this:

int foo;
int* bar = &foo;

And to edit with the pointer you would to this:
(*bar) += 5000;

But how would you do it in Lite-C and with vars?
Thanks if you helped!

Re: var pointers [Re: Sepiantum] #297081
11/04/09 22:56
11/04/09 22:56
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
var name = value;



name +=
name -=
name ==
name *=
name /=
name ++
name --

..etc..

http://www.conitec.net/beta/aarray.htm

Last edited by Espér; 11/04/09 22:57.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: var pointers [Re: Espér] #297085
11/05/09 00:44
11/05/09 00:44
Joined: Nov 2009
Posts: 34
S
Sepiantum Offline OP
Newbie
Sepiantum  Offline OP
Newbie
S

Joined: Nov 2009
Posts: 34
seriously, that is called declaring a variable and assigning a value to it and editing it directly. i want to declare a pointer to a variable and edit it indirectly by using its address like i can do in ANSI C.

Re: var pointers [Re: Sepiantum] #297096
11/05/09 02:30
11/05/09 02:30
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
It's the same as in ANSI C.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: var pointers [Re: JibbSmart] #297097
11/05/09 03:03
11/05/09 03:03
Joined: Nov 2009
Posts: 34
S
Sepiantum Offline OP
Newbie
Sepiantum  Offline OP
Newbie
S

Joined: Nov 2009
Posts: 34
Actually, I tried, but it didn't work. So that's why i'm asking.

Re: var pointers [Re: Sepiantum] #297098
11/05/09 03:09
11/05/09 03:09
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
try it with
Code:
int foo = 123;   //or some other value. freshly declared variables do NOT get set to zero.
int* bar = &foo;

And to edit with the pointer you would to this:
*bar += 5000;


but make sure foo is a global variables, otherwise its address becomes invalid
if the code hits a wait(1) command.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: var pointers [Re: Sepiantum] #297099
11/05/09 03:10
11/05/09 03:10
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Can you show a snippet which doesn't work, and explain what about it doesn't work (syntax error, incorrect results, etc)?

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: var pointers [Re: JibbSmart] #297101
11/05/09 03:25
11/05/09 03:25
Joined: Nov 2009
Posts: 34
S
Sepiantum Offline OP
Newbie
Sepiantum  Offline OP
Newbie
S

Joined: Nov 2009
Posts: 34
Well, I'm surprised. I rewrote my code and it worked! Although I have no idea how. I was testing var* one day and it didn't work. I was probably to lazy to look at my syntax in depth. Thanks.

Re: var pointers [Re: Sepiantum] #297213
11/06/09 00:14
11/06/09 00:14
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline
Senior Member
sadsack  Offline
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Boys, boys,boys!


I have A7 Commercial .............. Now I just need to learn how to use it


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