TCC problem

Programming, for all ages and all languages.
urxae
Member
Member
Posts: 149
Joined: Sun Jul 30, 2006 8:16 am
Location: The Netherlands

Post by urxae »

Buck1000 wrote:Does it have to be an unsigned char?
No, an unsigned short is also pretty common. That way, you can write both the character and the attribute byte in a single write, and incrementing the pointer points it to the next character on the screen.
(You could also use a regular char instead of an unsigned one if that's what you meant, but if that's a signed type on your compiler it might be tricky to use attributes with the high bit set)
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post by neon »

Buck1000 wrote:Does it have to be an unsigned char?
No.

It is guaranteed an unsigned char is a byte in size, though. Hence, an unsigned char* can easily be used to point to any byte in memory.

Other data type sizes are complier dependent. If you wanted, you can use a WORD size type, and just write one WORD for each character.

unsigned short is a pretty common WORD size.
Post Reply