Why specifying the data type for a given variable in C++, more than once results in a syntax error ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why specifying the data type for a given variable in C++, more than once results in a syntax error ?

plz tell me why it shows error I mean I am just specifying again the same data type what's wrong? plz don't answer like giving names to animals, humans, etc.

29th Jan 2018, 5:48 PM
FullCoder ALCHEMIST
FullCoder ALCHEMIST - avatar
2 Answers
+ 1
Ravi Chandra Enaganti I asked that even if I am not changing the data type ( also same variable ) then why it's showing error.WHY ?
29th Jan 2018, 6:28 PM
FullCoder ALCHEMIST
FullCoder ALCHEMIST - avatar
0
We can declare a variable only once according to C syntax. so you should follow that. once declared you cannot change the type of that variable like you do in Python or JavaScript or some other languages you might know.
29th Jan 2018, 6:05 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar