[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
mouse » Obfuscator » BeginnersGuideToPHP » DirectX » VisualCpp » Compaq » QBasicFAQ » VBNetFAQ » newcsharpdotentlink » realnumbers » CppVariable

(C++) Variable

A variable is something to store data in.

Don't declare a variable until you have a value to initialize it with [1].

In the code example below, there are two variables, number and i (actually argc and argv are also variables, but see their pages what they are)

  1. include <iostream>
int main() { int number = 0; for (int i = 0; i<10; ++i) { number+=i; std::cout << i << " : " << number << std::endl; } }


The variable number has the entire main function as its scope. The variable only has the for loop as its scope.

There are many different data types of variables.

Topic links

'Variable' links

Reference



last edited (November 18, 2006) by bilderbikkel, Number of views: 8779, Current Rev: 10 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Site Management by Lars Hagelin at Kontantkort.se.