[wplug] C code problem

Rick Smith rick at rbsmith.com
Wed Oct 23 17:05:38 EDT 2002


On Wed, Oct 23, 2002 at 04:05:30PM -0400, Henry Umansky wrote:
> Can someone explain to me why on my machine the printout value for i is 
> different.  I compile this with gcc version 2.95.3 20010315.  Can someone 
> else try compiling this and running it and keep an eye on the two values 
> that are printed out.

I can answer this but want to make sure it is not a homework
assignment or something that is intended for you to figure
out on your own.  I'll give you a hint: it has nothing to
do with the compiler.  I'll give you another hint: look
at the first line.

Rick



> #include <stdio.h>
> 
> int main() {
> int i;
> 
> for(i=0;i<100000000000;i++)
>        if(i%100000==0)
>        printf("%d : %d\r", i, i);
> }
> 
> 
> Henry Umansky
> University of Pittsburgh
> Systems/Programmer III
> www.pitt.edu/~hmust2
> hmust2 at pitt.edu
> (412)624-4357



More information about the wplug mailing list