I’d try to declare i
outside of the loop!
Good luck on solving 3n+1 🙂
Here’s an example:
#include <stdio.h>
int main() {
int i;
/* for loop execution */
for (i = 10; i < 20; i++) {
printf("i: %d\n", i);
}
return 0;
}
Read more on for loops in C here.
More Related Contents:
- C: for loop int initial declaration
- C: Why is counter not resetting to 0 in for loop [closed]
- Variable redeclaration in c in loop and outside loop?
- Modulo operation with negative numbers
- Why does the order of the loops affect performance when iterating over a 2D array?
- C undefined behavior. Strict aliasing rule, or incorrect alignment? [duplicate]
- Order of local variable allocation on the stack
- What is the meaning of lines starting with a hash sign and number like ‘# 1 “a.c”‘ in the gcc preprocessor output?
- Adding leading underscores to assembly symbols with GCC on Win32?
- aligned malloc() in GCC?
- Finding out what the GCC include path is [duplicate]
- GCC fatal error: stdio.h: No such file or directory
- Why doesn’t GCC optimize structs?
- Creating static Mac OS X C build
- Why do I have to define LD_LIBRARY_PATH with an export every time I run my application?
- Is there a macro definition to check the Linux kernel version?
- Why does gcc allow arguments to be passed to a function defined to be with no arguments?
- Status of __STDC_IEC_559__ with modern C compilers
- Errors using ternary operator in c
- What is the default C -std standard version for the current GCC (especially on Ubuntu)?
- What is “…” in switch-case in C code
- How to link to a different libc file?
- C code with undefined results, compiler generates invalid code (with -O3)
- Compiler changes printf to puts
- How to tell GCC to generate 16-bit code for real mode
- How to get the size of a C function from inside a C program or with inline assembly?
- Why is execstack required to execute code on the heap?
- GCC – no warning about an uninitialized array with -O0
- Order of fields when using a bit field in C
- conflicting types error when compiling c program using gcc