I have a variable userInput that contains something like C50+50 and an int variable number;
If i dowhen i do a printf number has 0 and now 50, why is that?Code:sscanf(userInput, "%d", &number)
I have a variable userInput that contains something like C50+50 and an int variable number;
If i dowhen i do a printf number has 0 and now 50, why is that?Code:sscanf(userInput, "%d", &number)
You can't parse a number from userInput because of the 'C' at the front. Try this:
Code:sscanf(userInput + 1, "%d", &number);
Oh i thought it would skip trash and go to the end until it finds an int. So i always need mo make sure i give an address that matches the type i want to read. Thanks!