0
popGrowth.c:12:17: error: expression result unused [-Werror,-Wunused-value]
    do x + (x/3)-(x/4); while (x < y);
       ~~~~~~~~~^~~~~~

Overall I am trying to complete an action to a start population number which is "x" while it is less than "y" as a loop. Then work out how many loop repeats there were and print that loop frequency answer as "Years to reach end population: \n"

Having the editor reply that the subtraction sign in the equation is not being used and underlining the whole equation has me flummoxed! where to look next?
Am I missing brackets and which type why?

0

1 Answer 1

0

The result of this expression x + (x/3)-(x/4); is unused because it is not set to anything. Remember, the syntax is [type] var = {expression} where [type] is optional if var has already been declared.

5
  • 1
    type isn't optional if var has already been declared, it's forbidden if you are in the same scope. That aside spot on.
    – UpAndAdam
    Commented Oct 25, 2023 at 14:12
  • Minor thing, if you could allow a chance for others to answer first it would be helpful for me as I'm trying to get enough rep to be able to help review and edit as well. Not taking any issue with your answers as a whole at all. I noticed we have no active mods & no one tending to the edit queue which has been full for months now. With only you and Cliff being active I wonder if you have enough votes to pass anything in the edit queue. Or if you could kindly upvote a few of my useful answers it would be appreciated. Love your profile statements btw.
    – UpAndAdam
    Commented Oct 25, 2023 at 14:16
  • @UpAndAdam: I don't think that it is reasonable to ask someone to delay an answer to a question, especially if they have no way of knowing whether someone else will answer and whether this answer will be good or not. However, I agree that the current status of the site is not good, as it appears abandoned Commented Oct 25, 2023 at 23:31
  • fair enough @AndreasWenzel that said there is a balance between fastest gun in the west and giving others a chance. i didnt say hold off infinitely but i get your point. where is the line
    – UpAndAdam
    Commented Oct 26, 2023 at 13:58
  • Thanks for your reply and yes the answer was as you suggested UpAndAdam. All sorted now thank you
    – BIR823
    Commented Nov 1, 2023 at 1:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .