We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
can u make a counter for 0-9999 with c ?
And the test was probably a form with yes/no answers.
Is it?
It seems that most new users (on this and many other forums) assume that it is the default encoding.
:-(
> Then he gets a job somewhere and the real-world finds out he knows nothing. <
Well, if he gets a job somewhere, then the real-world will not find out he knows nothing. The one who finds out he knows nothing, will soon be punished, for the finding.
i got sum code .here it is when u need it.
for ( i = 0 ; i != 9999 ; i = i + one )
;
i = 9999 ;
Hallelujah !
"i got sum code .here it is when u need it."
Thanks for sharing with us.
Complex, yet beautiful in its simplicity. Pure genius.
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?
> i got sum code .here it is when u need it. > > for ( i = 0 ; i != 9999 ; i = i + one ) > > ; > > i = 9999 ;
I have a quicker solution:
int i=0; while(i++<9999);
or, the hard way:
int *i=(int *) malloc(sizeof(int)); memset(i, 0, sizeof(int)); while(*i++<9999);
or ... after reading your code ... a much quicker solution:
int i = 9999;
*smile*
BR, /th.
int i=0; while( i++ < 9999 );
Although the source code may be briefer, it is rather unlikely that the generated machine code will be any different at all...
*pssschhhht* ...he doesn't know that! ;-)
Since we're now giving him the answers, here's the one I was going to suggest:
#define TWO 1 ... int i; i = 0; loop: i = i + TWO; if (i > 9999) goto end; goto loop; end: ...
whoops ...
#define Z 0 #define N 9999 #define F for #define I int #define B break #define C if I i=Z; F(;;) C(i++>N) B;
:-)
wtf? www.linkedin.com/.../b06
/* **====================================================================== ** My_Counter **====================================================================== ** ** Counts to MAX_COUNT and returns the MAX_COUNT value. ** **---------------------------------------------------------------------- ** ** Parameters Passed: <void> ** Parameters Returned: u16 -- the counted value ** Notes: ** ** 'ramble( )' expands to 9999 words of boredom. ** **---------------------------------------------------------------------- */ u16 My_Counter( void ) { ramble( 9999 ); // lots of comments }
--Cpt. Vince Foster 2nd Cannon Place Fort Marcy Park, VA
You don't say - this is a central part of a guidance system of some kind :-)