Go Back   Computer Forums > General Computing > Programming
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 02-05-2005, 10:55 PM   #1
Baseband Member
Rackham's Avatar
Join Date: Feb 2005
Posts: 21
Default Naming Variables in C++

Im just beginning to learn C++ and I am having trouble understanding why the variables in many sample source codes begin with a letter such as n or d.

Such as
int nVariable

Any help would be appreciated

Rackham is offline   Reply With Quote
Old 02-07-2005, 11:51 AM   #2
Daemon Poster
Tulsileaf's Avatar
Join Date: Jul 2004
Posts: 1,249
Default Re: Naming Variables in C++

because the programmers chose to name them that way. When naming a variable its important to choose a name following to rules:

1) when you see the name, you know instantly what the variable is for.

2) names should not conflict (e.g. int hey; char hey namespace solves this problem.

so i suppose that the name nVariable should remind the coder that nVariable is an integer that will be used for whatever purpose.

Sometimes there are guidelines set up on choosing names. See whomever is responsible for the source and ask what these guidelines are, if they exist.
Tulsileaf is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 08:14 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0