Thread: looping problem

  1. #1
    Registered User
    Join Date
    Jul 2014
    Location
    Cape Town, Western Cape, South Africa
    Posts
    1

    looping problem

    Can someone help me in C please I got a problem when I set a loop like
    for ( index =0; index<4;++index)
    It's only repeat the loop 3times and then the program crash what is that pls urgent!

  2. #2
    Registered User
    Join Date
    Nov 2012
    Posts
    157
    show code please

  3. #3
    Registered User
    Join Date
    Apr 2014
    Location
    Pakistan
    Posts
    7
    Well if you tell the compiler that the loop needs to run till its less than 4 then it will run, of course till 3. What you need to do is this:
    for(index=0; index<=4; ++index)

  4. #4
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Your loop counter is fine. It should pass through the loop 4 times.

    The problem is inside the loop or elsewhere.

    -

  5. #5
    Registered User
    Join Date
    Feb 2014
    Posts
    13
    share your entire source code with in the for loop

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Looping problem
    By main() in forum C Programming
    Replies: 4
    Last Post: 05-27-2010, 02:28 AM
  2. Looping problem
    By vutek0328 in forum C Programming
    Replies: 8
    Last Post: 09-22-2006, 01:45 AM
  3. looping problem
    By trixxma in forum C Programming
    Replies: 10
    Last Post: 05-20-2006, 10:17 PM
  4. Problem with looping.
    By rina in forum C Programming
    Replies: 9
    Last Post: 10-05-2005, 01:21 AM
  5. Looping problem.
    By prepare in forum C Programming
    Replies: 3
    Last Post: 10-06-2004, 09:57 AM