0% found this document useful (0 votes)
173 views1 page

Hungarian Notation

Hungarian Notation is a variable naming convention that includes type information in the variable name. This document provides examples of prefixes to include in variable names for different data types, such as "b" for boolean and "i" for integer. It also lists additional prefixes for properties like unsigned, constant, and reference variables. The document aims to define a clear naming convention for beginners to understand variable types from their names.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
173 views1 page

Hungarian Notation

Hungarian Notation is a variable naming convention that includes type information in the variable name. This document provides examples of prefixes to include in variable names for different data types, such as "b" for boolean and "i" for integer. It also lists additional prefixes for properties like unsigned, constant, and reference variables. The document aims to define a clear naming convention for beginners to understand variable types from their names.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Hungarian Notation

Charles Simonyi is credited with first discussing Hungarian Notation. It is a variable naming convention that includes C++ information about the variable in its name (such as data type, whether it is a reference variable or a constant variable, etc). Every company and programmer seems to have their own flavor of Hungarian Notation. The following is just what we thought seemed easy for beginning students to understand.
Prefix b c str si i li f d ld sz if is of os S C boolean character C++ String short integer integer long integer floating point double-precision floating point Old-Style Null Terminated String Input File Stream Input Stream Output File Stream Output Stream declaring a struct declaring a class Type bool bStillGoing; char cLetterGrade; string strFirstName; short siChairs; int iCars; long liStars; float fPercent; double dMiles; char szName[NAME_LEN]; ifstream ifNameFile; void fct(istream &risIn); ofstream ofNameFile; void fct(ostream &rosIn); struct SPoint { class CPerson { SPoint pointLeft; SPoint ptLeft; // or abbrev. (be consistent) CPerson personFound; CPerson perFound; // or abbrev. (be consistent) Example

long double-precision floating point long double ldLightYears;

struct name or abbrev declaring an instance of a struct class name or abbrev declaring an instance of a class

The following table contains letters that go before the above prefixes.
Pre-prefix u k r s rg m_ p prg unsigned constant formal parameter reference formal parameter static array (stands for range) pointer to a single thing dynamically allocated array Type Example unsigned short usiStudents; void fct(const long kliGalaxies) void fct(long &rliGalaxies) static char scChoice; float rgfTemp[MAX_TEMP]; char *pcGrade; char *prgcGrades;

member variable of a struct or class char m_cLetterGrade;

You might also like