Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, 7th_zorro), 877 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Some confusion about pointers #351922
12/29/10 16:09
12/29/10 16:09
Joined: Sep 2010
Posts: 82
P
peteredlin Offline OP
Junior Member
peteredlin  Offline OP
Junior Member
P

Joined: Sep 2010
Posts: 82
Hi, i am new to pointers and dealing with them..

i got the folliwing code which i cant figure out how to work right:
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <ackphysx.h>

///////////////////////////////


function Create_ent(ENTITY**ent,char*filename,VECTOR*position)
{
	ent = ent_create(filename,position,NULL);
	

}


ENTITY* box;

function main()
{
 	physX_open();
 	level_load("level.hmp");
 	Create_ent(box,"cube.mdl",vector(0,0,0));
 	box.x=90;
 	
 	
}



I get an error in main called SYS..
I want to load box with the pointer 'ent'

Last edited by peteredlin; 12/29/10 16:09.
Re: Some confusion about pointers [Re: peteredlin] #351923
12/29/10 16:25
12/29/10 16:25
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
You have to dereference your pointer: (notice the asterisk)

*ent = ent_create(filename,position,NULL);

Re: Some confusion about pointers [Re: Saturnus] #351924
12/29/10 16:30
12/29/10 16:30
Joined: Sep 2010
Posts: 82
P
peteredlin Offline OP
Junior Member
peteredlin  Offline OP
Junior Member
P

Joined: Sep 2010
Posts: 82
Thank you very much

I have one more question about pointers, this has to do with structs.

If i create 2 structs of the same type, and i want to use them for loading a fucntion with variables how must i write that function then? (that one and the same fucntion can work with multiple structs)

Thanks in advance.




Last edited by peteredlin; 12/29/10 17:25.

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