How to use for loop with only initialization statement and test expression in C

1 Answer

0 votes
#include <stdio.h>

int main() {
    int counter = 7;

    for (int i = counter; i--;) {
        printf("%d ", i);
    }
}



/*
run:
   
6 5 4 3 2 1 0 
            
*/

 



answered Oct 24, 2024 by avibootz

Related questions

1 answer 251 views
1 answer 236 views
236 views asked Jun 26, 2021 by avibootz
1 answer 370 views
1 answer 364 views
1 answer 269 views
1 answer 233 views
1 answer 301 views
...