for loop until 0
how can I write the code to loop the a value to 0 without using signed int?
I try ==0, but it doesn't work
|
for(signed int a=10;a>-1;a--)
|
|
for (unsigned int a = 10; a <= 10; a--)
|
This works because when an unsigned number is decremented below zero it wraps around and becomes the largest possible value.
Last edited on
i think you are confusing about looping
1 2
|
int a=0;
for(;a>=0;a--)
|
thx
Topic archived. No new replies allowed.