So declaring a variable as the same value results in a syntax error? but re-declaring the variable is okay? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

So declaring a variable as the same value results in a syntax error? but re-declaring the variable is okay?

Also is there anything else that prompts a syntax error?

1st Aug 2017, 7:03 PM
Isaiah
1 Answer
0
if I'm understanding you correctly then this should help. if you do something like int main () { int i = 0; int i = 1; } then you'll get an error because i already exists when you try to initialize it with 1. however, if you do int main () { int i = 0; i = 1; } then you'll get no errors since your only changing the value inside i.
3rd Aug 2017, 6:46 PM
Christian
Christian - avatar