In which line is there an error in the code snippet given below? [code] int x=10; const int b; x=b; b=x; [/code]

Answer: D
Explanation: In the last line, the variable ‘b’ cannot accept any other value since it is declared ‘const’ at the beginning of the code snippet. However, the previous line is correct since the variable ‘a’ is not declared ‘const’ in the code snippet, so it can accept the value from ‘b’.
 

Tìm kiếm

Back
Top