As programs have become more complex both in terms of size and of the proliferation of data types, many programmers have adopted a variable-naming convention, which is commonly referred to as Hungarian notation (apocryphally named in honor of Microsoft programmer, Charles Simonyi).
NOTE
Over the past several years, several “standard” versions of Hungarian notation have been proposed and/or published. The version given here is dictated in part by personal preferences and in part by conventions established by Windows in naming constants, variable, and data structure definitions. Because all of these standards are intended to be mnemonic for your convenience, you may follow or alter them as desired.
Using Hungarian notation, variable names begin with one or more lowercase letters that denote the variable type, thus providing an inherent identification. For example, the prefix h is used to identify a handle, as in hWnd or hDlg, referring to window and dialog box handles, respectively. In like fashion, the prefix lpsz identifies a long pointer to a null-terminated (ASCIIZ) string. Table 2.1 summarizes the Hungarian notation conventions.
Table 2.1: Hungarian Notation Conventions
Prefix | Data type |
b | Boolean |
by | byte or unsigned char |
c | Char |
cx / cy | short used as size |
dw | DWORD, double word or unsigned long |
fn | Function |
h | Handle |
i | int (integer) |
l | Long |
n | short int |
p | a pointer variable containing the address of a variable |
s | string |
sz | ASCIIZ null-terminated string |
w | WORD unsigned int |
x, y | short used as coordinates |