+ 1

Why the keyboard 'const double' not 'const'?

4th Nov 2019, 4:44 AM
shridhar w
shridhar w - avatar
6 Respostas
+ 2
You need to specify that what type of data is going to be constant. For eg- const int x = 10; const double y = 22.45;
4th Nov 2019, 4:51 AM
Avinesh
Avinesh - avatar
0
Constants A constant stores a value that cannot be changed from its initial assignment. By using constants with meaningful names, code is easier to read and understand. To distinguish constants from variables, a common practice is to use uppercase identifiers. One way to define a constant is by using the const keyword in a variable declaration: 》》》I am asking about this constant but in code... const double.. is used
4th Nov 2019, 4:55 AM
shridhar w
shridhar w - avatar
0
shridhar w that's what I have mentioned, you can create constants like that and their value cannot be altered in the code. For eg take the value of PI which is a constant.
4th Nov 2019, 4:59 AM
Avinesh
Avinesh - avatar
0
Yeah😅😅 Understood.... You need to specify data type whichs going to be constant.
4th Nov 2019, 5:02 AM
shridhar w
shridhar w - avatar