# UINT,LPCSTR,DWORD what are they?

## Recommended Posts

dk32321    142
I have seen these data types alot, i am pretty sure they are data types, can somebody tell me what they are and what they do

##### Share on other sites
Yes, they're just data types.

UINT is an unsigned integer.
LPCSTR is a pointer to a constant string (char* or wchar_t* for unicode).
DWORD is a double word (a 32 bit unsigned integer).

##### Share on other sites
mnansgar    421
They are a strange mix of conventions (what follows are TYPICAL definitions):

typedef unsinged int UINT;             // Unsigned INTegertypedef char * LPCSTR;                 // Long Pointer to Character Stringtypedef unsigned long DWORD;           // DoubleWORD

In Microsoft's Hungarian Notation scheme for naming variables, the prefix 'lp' stands for "long pointer", 'c' stands for "character" and 'u' stands for "unsigned". From the old days of programming, pointers could be long or short, depending on how far away in the absolute memory address your data was (due to the convoluted addressing schemes of old Intel chips). Nowadays, ALL pointers are long pointers, but Microsoft insists on still using "lp"!

A doubleword is two words, and what a "word" is exactly is often ambiguous. Typically, a word is the "bittage" of your processor, so if you have a 32-bit processor then the word size is 32 bits. However, a word can also mean 16 bits, which is what I believe the word size was when people started using "word" and "doubleword" to describe memory. Hence, DWORD is typically defined as 32 bits.

The idea behind using these typedefs is twofold. First, they are a convenience to type! Second, and more importantly, they let your program be easily updated to new architectures. For instance, on some machines an "int" may not be 32 bits! Hence, if you used the LPCSTR convention to declare all of your variables and you suddenly found that you actually wanted your strings to be Unicode, you can just change the definition to "long *" and it would change every variable declaration in your program!

##### Share on other sites
anist    100
UINT = unsigned int
LPCSTR = char* (long pointer to a C style string... C style = ends with a 0)
DWORD = unsigned long int (double word)

EDIT: sorry, too late.

##### Share on other sites
mnansgar    421
I thought I'd comment on the above two posts as well, since they bring up interesting notational points.

>> LPCSTR = char* (long pointer to a C style string... C style = ends with a 0)
The typical prefix for a "ends with a 0" string is 'z'. Hence, a "long pointer to a 0-terminated character string" is LPZSTR.

>> LPCSTR is a pointer to a constant string (char* or wchar_t* for unicode).
The typical prefix for "constant" is 'const' or 'k' (note these are typically only for formal parameters). Hence, a "constant long pointer to a character string" would be: KLPCSTR. This prefix is rarely used, however.

##### Share on other sites
shuma-gorath    1161
In case you ever wonder about the other data types, here is the complete list.