16.04.2013, 16:36
(
Последний раз редактировалось Isolated; 16.04.2013 в 20:49.
)
I've worked out, for myself, before I read what's listed below that you can use hex numbers for anything.
Although there is no real reason for using HEX numbers, other than colors, it could be useful to a few people, however they cannot be used as floats, strings or anything other than integers that I've found.
Useful things from Basssiiie:
ASCII
Hexadecimal
Code optimisations
pawn Код:
#include <Pawn/Default>
main()
{
new a, b, c, abc, health;
health = 0xFFFF; // Would be a unlimited health value.
a = 0xA;
b = 0xB;
c = 0xC;
abc = 0xABC;
/*
A = 10
B = 11
C = 12
ABC = 2748
Health = 65538
*/
printf("a = %d b = %d c = %d abc = %d health = %d", a, b, c, abc, health);
}
Quote:
Originally Posted by Basssiiie
Maybe you might want to read this. It explains why 0xF works and why 0xG doesn't work.
But indeed, 0xA is the same as 10, which is also the same as 0b1010, which is also the same as 75 - 65, which is also the same as 'K' - 'A' (Ascii character codes). For more information about this similarity stuff, you might be interested at this, look under Minor Optimisations -> Small Snippets -> Equivalence. |
ASCII
Hexadecimal
Code optimisations