C++: difference between 0. and 0.0?
I am well aware of the difference between 0 and 0.0 (int and double). But is there any difference between 0. and 0.0 ( please note the . )? Thanks a lot in advance, Axel There is no difference. Both literals are double. From the C++-Grammar: fractional-constant: digit-sequenceopt . digit-sequence digit-sequence . See: Hyperlinked C++ BNF Grammar No, there is not. No. You can also write .0 as far as I know. Just having the . as part of the number identifies it as a floating point type. This: cout << (5 / 2) << endl; cout << (5. / 2) << endl; cout << (5.0 / 2) << endl; Prints this: 2 2.5 2.5 You