
C++
ilvtt1314
这个作者很懒,什么都没留下…
展开
-
Managing compound expressions
1. Parenthesize expressions;2. When you change the value of an operand, do not use it elsewhere in the same expression. Reference:原创 2013-11-16 18:12:52 · 770 阅读 · 0 评论 -
How to declare a null pointer
1. *p=nullptr; (C++ 11)2. *p=0;3. *p=NULL; (include )原创 2013-11-14 17:11:16 · 622 阅读 · 0 评论 -
Pay attention to pointers: always initialize your pointers
1. Define a pointer after the object to which it points has been defined.2. If not, initialize the pointer to nullptr or zero.Reference:C++ Premier (5th version)原创 2013-11-14 17:18:03 · 630 阅读 · 0 评论 -
Which type to use in Cpp
Source from C++ Premier (5th version).use an unsigned type when you know that the values cannot be negative.use int for integer arithmetic.use long long when the data values are larger than the原创 2013-11-14 11:48:16 · 632 阅读 · 0 评论 -
How to generate EOF from keyboard
In UNIX OS, in general, the EOF can be generated by typing CTRL+D;In WINDOWS OS, in general, the EOF can be generated by typing CTRL+Z.原创 2013-11-14 10:35:04 · 611 阅读 · 0 评论 -
Type Conversions in Cpp
Source from C++ Premier (5th version).non-bool to bool: bool=1 if non-bool != 0; bool=0 if non-bool ==0;bool to non-bool: non-bool=1 if bool==1; non-bool=0 if bool==0;float to int: truncate deci原创 2013-11-14 14:19:10 · 575 阅读 · 0 评论