Skip to content
Sign upLog in
← Back to Community

Why is my code giving me errors?

Profile icon
DarkswordsmanJG

My code keeps giving me errors and I don't know how to fix it. This confuses me because I have codes that look like this but don't give me errors. Please help

Voters
Profile icon
DarkswordsmanJG
Comments
hotnewtop
Profile icon
Baconman321

From what I see, the first error is saying there is no variable with that name. Try checking for misspelling (happens alllll the time with me). Second, the rest are saying that your variable you are comparing is a pointer. Try dereferencing the variable, and all should be fine. If it's not supposed to be a pointer, check if you have any "*" in any variable declarations, because that means it's a pointer (pointing to where the value is stored in memory).

Profile icon
RYANTADIPARTHI

You are getting this error because you are trying to compare a variable to a boolean value. this is not correct syntax. Change that. and you will not have any errors.

Profile icon
DarkswordsmanJG

@RYANTADIPARTHI
I changed it to a char, int, float, and string and it still it gave me errors, thanks though

Profile icon
RYANTADIPARTHI

@DarkswordsmanJG
np. click check mark.

Profile icon
InvisibleOne

Screen Shot 2020-12-17 at 8.51.45 AM


becuase when you are doing that, it is incorrect syntax. If you are checking if something is equal to something else you use '=='. If you simple use one '=' then the program things you are trying to assign that variable to a new value. Change your '=' in your if statements to '==' and it should work

Profile icon
DarkswordsmanJG

@InvisibleOne
It still tells me that there is an error when I run it, but thanks