Which of the following is not a valid variable name declaration? a) float PI = 3.14; b) double PI = 3.14; c) int PI = 3.14; d) #define PI 3.14
Answers
Answered by
6
Calcium is a chemical element with the symbol Ca and atomic number 20. As an alkaline earth metal, calcium is a reactive metal that forms a dark oxide-nitride layer when exposed to air. Its physical and chemical properties are most similar to its heavier homologues strontium and barium.
Answered by
0
Option C is an invalid way of declaring a variable name declaration.
. float is a short notation of floating numbers. Float is a keyword that is used to represent floating numbers (decimals). Hence, the declaration float PI = 3.14 is correct.
- Double is a keyword that is an extension of int and float. Double can store a numerical value up to 15 digits. Doubt can be of any time (integer or decimal). Hence, the declaration double PI = 3.14 is correct.
- Int is a short notation of integers. Int is a keyword that is used to represent integer values only. It cannot represent decimal values in any case. Hence, the declaration int PI = 3.14 is incorrect.
- #define is a preprocessor that allows us to assign the values for symbolic names and constants. #define Pi 3.14 implies, assign the value of pi as 3.14. Hence, the given statement is correct.
Therefore, Option C is the incorrect declaration. Hence, Option C is the correct answer.
Similar questions