Link to home
Start Free TrialLog in
Avatar of tariq6000
tariq6000

asked on

for loop not iterate more than 800000

hi,

i wrote a simple FOR LOOP  program in cocoa-objective c   (MAC os- compiler XCode). but it not working properly. the loop iterating  only upto some value near to 714300( value change each time running). program is given below.

#import <Cocoa/Cocoa.h>

int main(int argc, char *argv[])
{
   unsigned long long i=1;
   
   for(i=1;i!=0;++i)
            printf("%llu\n",i);

      printf("finished");
      //printf("\n%llu",i++);
      
      //printf("\r%llu",i);
      
       return NSApplicationMain(argc,  (const char **) argv);
}


if first printf statement is replaced as printf("%llu-",i); it iterate beyond 1000000 but it run very slowly( take nearly one hour to reach 1000000). what is the problem with this program.



Avatar of peetm
peetm
Flag of United Kingdom of Great Britain and Northern Ireland image

What compiler are you using?

On my system, ULONG_LONG_MAX is 4,294,967,295

Therefore I'd expect my system to get rather 'warm' running your app here.


Avatar of tariq6000
tariq6000

ASKER

now  i am using mac mini -Tiger 10.4


compiler is Xcode
ASKER CERTIFIED SOLUTION
Avatar of F. Dominicus
F. Dominicus
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial