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 148 views
1 answer 128 views
128 views asked Jun 26, 2021 by avibootz
1 answer 247 views
1 answer 230 views
1 answer 174 views
1 answer 141 views
1 answer 199 views
...