[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
cppint
Displaying differences between revision 7 and the latest revision


= ([[CCplusplus | C/C++]]) int =

[[CPPppDataTypes | dData type]] (and thus a keyword) that can hold a single whole number. I

The range o
f yan int can be found asst [[CppCompignleTime | compile time]] with [[CppNumeric_limits | std::numeric_limits]].¶

If y
ou assign a broken number to an int, this value gets rounded down. Your compiler should give you a warning then, as in the example below.

[code]
#include <cassert.h>

int main(int argc, char* argv[])
{
const int myValue = 12;
const int myBrokenValue = 12.9;
assert(myValue==myBrokenValue);
return 0;¶
}
[/code]

== Advice ==¶
*
Prefer a plain int over a short int or a long int (ref. 1, 4.10.14)

== Top'icnt' links ==¶
* C
* C#
* SQL

== Code
links ==
* #include
* argc
* argv
* assert
* [[CppCassertH | cassert]] (header file)¶
* [[CppC
har | char]]
* const
* int
* main
* return
* std

== Reference ==
* 1) Bjarne Stroustrup. The C++ Programming Language (3rd edition).ISBN: 0-201-88954-4




last edited (May 28, 2007) by bilderbikkel, Number of views: 15696, Current Rev: 15 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  
© 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.