muchos gracias bill, simply put.


On Jun 22, 2009, at 9:54 PM, Billy wrote:

i < 8 is the condition being evaluated so the moment it returns true (when i == 7) thats it. j has no influence on the evaluation of this condition. its same as if you had done

main()

{
       int i, j;

       for (i=0, j=1; i<8; i++)
       {
       printf("%d - %d = %d\n", j, i, j - i);
       j++;
       }
       return 0;
}

-Billy


2009/3/22 Rahim Kara <rahim@applecentre.co.ke>
It's a basic question and i'm sure alot of you can answer this but i'm still a bit sure. Take a look at the code below.

#include <stdio.h>

main()

{
       int i, j;

       for (i=0, j=1; i<8; i++, j++)
       
       printf("%d - %d = %d\n", j, i, j - i);
       return 0;
}

Now the results yielded are

1 - 0 = 1
2 - 1 = 1
...
8 - 7 = 1

i'd like to know what the delimiting factor here is, i.e. considering i've not set a loop limit for j, what's stopping my calculation from being as follows..

148 - 8 = 0

as an example though from my understanding, it should present an infinite loop.

I\ve been pondering this a while, thought i'd get some Guru's out there to help out with my understanding of this.

Rahim.

_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
Other services @ http://my.co.ke
Other lists
-------------
Skunkworks announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science - http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi - http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
Other services @ http://my.co.ke
Other lists
-------------
Skunkworks announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science - http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi - http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

Rahim Kara | Pro App's Specialist
Elite Computers Ltd

 Apple Premium Reseller 
Sarit Centre
P.O.Box 75289, Nairobi – 00200
KENYA
+254 (20) 374 5550 PHONE
+254 (20) 375 3509 FAX
+254 721 875 042 Safaricom MOBILE
+254 734 334 074 Zain MOBILE
+254 773 104 250 Orange MOBILE

Mailing List Subscription