The difference between #define and const
#1

Hello guys.
I really want to know: what's the difference between #define and const?

Sorry for my English.
Reply
#2

I've pondered over this myself a few times, because in a numerical context they aren't at all different. The only advantage I can think of using #define is that you can prepend it with a hash sign to turn it into a string. But that doesn't really work out if the number is between brackets (which it is in most cases).
Reply
#3

#define POSITION 100.0, 200.0, 300.0
const position= [100.0, 200.0, 300.0];

SetPlayerPos(playerid, POSITION);
SetPlayerPos(playerid, position[0], position[1], position[2]);

no test.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)