-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNOTES(imp points)
More file actions
7 lines (7 loc) · 1.6 KB
/
NOTES(imp points)
File metadata and controls
7 lines (7 loc) · 1.6 KB
1
2
3
4
5
6
7
->by default integers are signed means can be + or - but if you want only positive integers than you should apply unsigned on it.
->declaring unsigned short int exam_score(55); is same as unsigned short exam_score(55);
->List initialization: for example, initializing long people_on_earth(7'600'000'000) ; benefits of using listeners initialization is, it will catch those problems for me at compile time. As in this example we are long using long data type instead of long long datatype so at complie time it gives error and says error narrowing conversion means **overflow** , it's trying to fit that no. into a long, and it doesn't fit.
->in float we have less precision and in double we have more precision than float and in long double we have high precision then double.(long double > double > float : precision order).
->**sizeof** operator gets its info from 2 C++ include files, climits and cfloat. climits provide info about integeral types and cfloat abt floating point types. these include file also provides a bunch of handy defined constants that we can store in an int on this specific machine. for example INT_MAX,INT MIN, LONG_MIN,LONG_MAX,FLT_MIN,FLT_MAX.
->constants are very much like C++ variables and difference btw variables and constants is unlike variables c++ constants cannot change once they're declared.
c++ gives us several ways to create constants as we can use literals(for ex. x = 12 or y = 1.256 or j = 'frank' ), declared constants(for ex. const double pi(3.1415926) means constants declared using the const keyword), constant expressions, enumerated constants and defined constants(use by # define ).