Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
creating variables (C)
#11
Well, I don't know C, but in C++ it's done like this:
Code:
int* pointer;
pointer = new int;

'new' creates the variable dyamically on the free store.. I think this is what nathan showed you for C. I don't see much point in doing it for simple variables though, it's more use when you want to create new structs, for instance.
In a world without walls and doors, who needs Windows and Gates?
Reply
#12
k Smile
Reply
#13
But again, these variables are not created in run time... they are just allocated in run time, like I explained to do in C (malloc). In fact, new does an automatic malloc.

Also, I though you were coding in C, like reads in the title of this topic. Just puzzled.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#14
I am coding in C but I got the idea from forteran.
Reply
#15
Quote:But again, these variables are not created in run time... they are just allocated in run time, like I explained to do in C (malloc). In fact, new does an automatic malloc.

Also, I though you were coding in C, like reads in the title of this topic. Just puzzled.

I thought by creating he actually meant allocating.. but I'm getting cofused so I'll just shut up now Wink
In a world without walls and doors, who needs Windows and Gates?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)