User forums > General (but related to Code::Blocks)

Code Issue in FOR() loop

(1/1)

Phred:
The following code does not stop at zero...it continues to negative numbers and keeps going until manually stopped.  Is there any way to make with work correctly?

#include <stdio.h>
#include <stdlib.h>

int main()
{
    size_t j;

    for( j = 44; j >= 0; j -= 11)
    {
        printf("%d\n", j);
    }
    return 0;
}

oBFusCATed:
Type s before size_t. Then search which using unsigned types like size_t is not a good idea. :)

Navigation

[0] Message Index

Go to full version