Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Home » Tip Bank » C++
Language: C
Expertise: Beginner
Mar 16, 2004

A Convention for Naming Variables

Naming variables has a major effect on how hard it will be for a person to follow the code, whether it is the same person who wrote it or someone else. To avoid confusing others, many programmers use the Hungarian Naming Convention when naming variables. This way, variables of same type have the same prefixes.

Prefix		Type
f		boolean
ch		char
sz		zero-terminated string
fn		function
w		word
b		byte
l		long
u		unsigned word
bit		a single bit
v 		void
p		pointer
i		index to an array
h		handle
mp		an array
And so on...

Here are some examples:


char szName[40], *pchSex;
int uAge;
int fIsMarried;
int mpChildAges[4];
etc.
Raducanu Bogdan
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date