Page 1 of 1

PostPosted: Sun Jan 12, 2003 6:00 pm
by md_lasalle
Does pocketc Supports Struct instruction? if yes what is the syntaxe?

thanks

PostPosted: Sun Jan 12, 2003 6:19 pm
by soinsg
No, but you can fake them:
Code: Select all
int player[2];
#define .x [0]
#define .y [1]

player.x = 10;

or:
Code: Select all
pointer player;
#define .x [0]
#define .y [1]
#define .name [2]

player = malloct(1, "iis"); //int int string
if (!player) alert("Bad malloct()!");
player.name = "mixed types";

PostPosted: Sun Jan 12, 2003 6:30 pm
by md_lasalle
I tried :

pointer Hero;
Hero = malloct(1,"isiisssssss");

and it says : "initializer doesn't match variable type"

PostPosted: Sun Jan 12, 2003 7:45 pm
by soinsg
Sorry, my bad, I should have said, "use malloct() inside another function".
Code: Select all
main() {
pointer ptr;
ptr = malloct(1, "scip");

//code here

free(ptr);
}