Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

how to use datatypes: word and dword in c

#include<stdio.h>
#include<string.h>

which include library do I need to have word and dword.
Avatar of ozo
ozo
Flag of United States of America image

typedef theTypeYouWantToUseForWord word;
typedef theTypeYouWantToUseForDword dword;
Neither one.  'word' and 'dword' are part of the language.
You might find some appropriate types to use in
<stdint.h>
Avatar of phoffric
phoffric

Did you mean DWORD and WORD rather than dword and word?
In any case, none of these four tokens are part of the ANSI C language. DWORD and WORD are created by Microsoft so that if you use them, you will have more trouble porting to other systems, and be stuck using Microsoft. Do avoid them if you do not need them.

From http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx
DWORD
A 32-bit unsigned integer. The range is 0 through 4294967295 decimal.

This type is declared in IntSafe.h as follows:

typedef unsigned long DWORD;
 
WORD
A 16-bit unsigned integer. The range is 0 through 65535 decimal.

This type is declared in WinDef.h as follows:

typedef unsigned short WORD;
 
The size of long is implementation dependent. Maybe Microsoft constrains long to be 32-bits.
ASKER CERTIFIED SOLUTION
Avatar of HooKooDooKu
HooKooDooKu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

I type
dword
no intellisense until I add
<minwindef.h> to the top of file

thanks