+ 1
Expected initializer before '+=' token. SOLVED
I've tried to google this issue but all of the questions were involved with templates. I'm trying to create a ramp-like thingy out of hashtags, but this issue keeps popping up in line 13 where I'm trying to addition nL with itself. I'd appreciate any kind of help and thanks in advance! :) The following code is edited and is not the original script of this question. It has however been fixed and changed a little with help of this question. https://code.sololearn.com/chuO8mVf7hA6/?ref=app
11 Réponses
+ 6
https://code.sololearn.com/crBRMkBXv7tc/?ref=app
you had already declared nl and symbol as global variables. by declaring them again locally it creates a different version. that version in your code has no value. thus the error re uninitialised
+ 7
also you need to replace if(i=nL) by if(i==nL)?
+ 6
Your code is strange, int nL += nL ? 😑 (not to mention, er wrong)
+ 6
jay figured out what you wanted to do apparently 😂
+ 5
Karl is correct
i=nL is an accidental assignment
+ 5
re emtpy boxes -> local declaration of char symbol.. overrides global char symbol.
+ 5
here is a little article explaining the difference between local and global variables
https://www.funprogramming.org/50-What-are-global-and-local-variables.html
+ 1
Is that something you can't do?
+ 1
Strange... I did that first but the output just came up with empty boxes. Thanks a lot though!
+ 1
Oh ye, rookie mistake. Thanks. xP
+ 1
Thanks for the hint, Jay. I didn't know that. :)