[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
CppMethod » CppPrivate » The GPRMC Sentence » QBasicFAQ » QbasicFAQ_UsingSoundCard » CppVcl » QbasicFAQ_BadFileMode » database » WhatLinksHere » encryption » CppDefinition

(C++) Definition

Specifying the value of a variable or specifying the body of a function.

Variable definition

Setting the value of a variable:

const int value = 3;


Opposite of a declaration:
  int declaredValue; //Just a declaration, can be any value


Postpone variable definitions as long as possible [1].

Function definition

Specifying the internals of a function, instead of declaring the function's arguments and return type. Function definitions are mostly found in .cpp files.

double calculateSum(const std::vector<double>& myVector)
{
  double sum = 0.0;
  const int size = myVector.size();
  for (int i=0; i!=size; ++i)
  {
    sum+=myVector[i];
  }
  return sum;
}


'Definition' links

Code links

Reference



last edited (December 6, 2006) by bilderbikkel, Number of views: 10705, Current Rev: 9 (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.