Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Fundamentals of C - Operations & Expressions Quiz

Hi,

In the Fundamentals of C - Operations & Expressions Quiz, I get stuck after question 2. Would anyone be able to explain to me how the last 3 questions should be solved. Here is a URL, just in case:

http://teamtreehouse.com/library/operators-expressions

Q3:

Auto increment the variable named unstable:

int unstable = 25; unstable -= 5 (Blank)

I was thinking the answer would be "unstable = 20;" but that's not it.

Q4:

Auto decrement the variable named unstable:

int unstable = 25; unstable -= 5; unstable++; (Blank)

My wrong answer: unstable = 21;

Q5:

Use the compact form of division to divide unstable by 3

int unstable = 25; unstable -= 5; unstable++; unstable--; unstable (Blank) 3;

My answer = unstable / 3;

(This probably doesn't belong in iOS, but C didn't have it's own section & this was the closest I could think to submit this Q.)

Got Q5 - it's "/="

5 Answers

For #3, to autoincrement the variable, it is unstable++ because they aren't asking for you to actually do it but to know how to set it up for loops etc.

For #4, to auto decrement is unstable-- because you want it to continue if your function was run multiple times.

For #5, you want to combine them to be unstable /= 3 because you are telling the variable to become the number you get when it is divided by three.

Mark McCuller
Mark McCuller
3,539 Points

Thank you Emilia. I was putting in the output numbers you would get if Increment or decrement unstable variable when all they wanted was how to set it up in the code.

Considering that the order of the questions is random, you need to be more specific for us to know how to help you out. You are welcomed to check out the "Tips for asking questions" video on the right (or below) for suggestions for how to format your question.

To best assist you in your learning process, it would also be helpful if you can let us know how much you already know, what you have tried, or even simply what solutions have crossed your mind. These information are all useful for other users in gauging your level of understanding and construct a response that you can understand easily while helping you learn.

Cheers,

John

Hey John,

I updated the question. In this case the questions were in the same order every time, but it does make it easier to have them here as well.

As for my current knowledge, when it comes to C, it's only the first few stages that I'm currently up to - so not too far at the moment. I got through HTML, CSS, and some PHP (so I can know how to build custom WP layouts). But when it comes to development as opposed to design, I'm still in the beginning stages.

  • Stan
Laurence Bowe
Laurence Bowe
6,222 Points

I got the same issue HELP!!!!!

Mark McCuller
Mark McCuller
3,539 Points

I can’t get the right answer for question #3 to #5. I know that from question #2 (25 -=5 = 20) that unstable is 20. In question #3 “Auto increment the variable named unstable:” so 20 +1 =21 but this is wrong. What is the correct answer? In Question #4 “Auto decrement the variable named unstable:” 21 -1 =20 but this is wrong. What is the correct answer? Question #5 “Use the compact form of division to divide unstable by 3” is wrong also because question #4 is wrong. I assume the answers are added and subtracted to the unstable variable. Can someone help me understand what I am doing wrong, Thank you for your help.