Hungarian notation is a naming convention for variables in source code. It dictates rules for choosing the name for variable that reflects its type. Specifically, each type has a prefix which is prepended to a meaningful name for each declaration of that type. For example, an integer blat would be iBlat and a float would be fBlat. The following shows some common prefixes:

The prefixes are cumulative: more than one can be used by stacking them up at the start of the variable name. For example, lpszGreep would be a long pointer to a nul-terminated string named greep.

The idea is that the variable, when seen outside the context of its declaration, carries type information with it. The programmer does not have to refer back to the declaration to find out what it is. In practice, this turns out to be of limited use, and most non-Microsoft coding styles steer clear of Hungarian. The style tends to make code look cluttered and unreadable. It can be confusing in situations where the type of an object is less important than the interface, such as when polymorphism is used.

A variant of Hungarian notation is sometimes used with object oriented languages such as C++ or Java. Here, the scope of the variable, rather than the type, is represented by the prefix. Some examples are prepending "m" or "m_" to member variables or prepending an underscore to private and protected members and methods.

This naming convention gets most of its popularity from Microsoft's influence. The variables and types one interacts with when programming for their Windows operating system all use Hungarian notation. The name comes from its inventor, Charles Simonyi, a talented programmer and Chief Architect at Microsoft. Simonyi is Hungarian, and some think the resulting names look like they are written in a foreign language.