This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

0-9999 counter with c

can u make a counter for 0-9999 with c ?

Parents
  • On one hand, you haven't defined "one". On the other hand - would "one" be allowed to be given any value, or might your little counter possibly get into troubles for some values for "one"?

    If you intend "one" to always be the value 1, why would you create a named variable or constant "one"? That is about as clever as creating a variable for pi named m3_1415926535. Having a constant with the same name as the value normally don't help, with a few exceptions. Having a constant is something you do to not have to remember the actual value, or to allow the constant to be changed. But as already mentioned - would it be allowed to change "one" to another value and would some values be unsafe?

    Is there a reason for both having a loop and a direct assign of i = 9999?

    And what is the data type for i?

    By the way - did you post the code to have us check it out, or to help others who wants to know how to create a counter that counts to 9999?

Reply
  • On one hand, you haven't defined "one". On the other hand - would "one" be allowed to be given any value, or might your little counter possibly get into troubles for some values for "one"?

    If you intend "one" to always be the value 1, why would you create a named variable or constant "one"? That is about as clever as creating a variable for pi named m3_1415926535. Having a constant with the same name as the value normally don't help, with a few exceptions. Having a constant is something you do to not have to remember the actual value, or to allow the constant to be changed. But as already mentioned - would it be allowed to change "one" to another value and would some values be unsafe?

    Is there a reason for both having a loop and a direct assign of i = 9999?

    And what is the data type for i?

    By the way - did you post the code to have us check it out, or to help others who wants to know how to create a counter that counts to 9999?

Children
No data