English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

What is the difference between following commands?
1. #define STATUS 0x1
2. #define STATUS 0x01
3. #define STATUS 0x0001

2006-10-19 19:53:57 · 3 answers · asked by Bear 2 in Computers & Internet Programming & Design

3 answers

#1 defines STATUS as a bit
#2 defines STATUS as a byte
#3 defines STATUS as 2 bytes

if you try to use 1 or 2 with a 2 byte number, say to add to, the answer may not be what you expect because the remaining bits are unknowns.

2006-10-20 02:26:37 · answer #1 · answered by justme 7 · 0 0

None to the computer - makes it _look_ different for human readability.

For example, if I was defining a colour as a hex, I would type 0x000020 and not 0x20, because it would put it in more context for other people. The computer doesn't mind one way or another.

Rawlyn.

2006-10-20 04:16:48 · answer #2 · answered by Anonymous · 0 0

No difference. For readability, it indicates the size of the constant.

2006-10-20 02:58:39 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers