Results 1 to 2 of 2

Thread: outer loop in C

  1. #1
    ashley_black is offline Member
    Join Date
    Feb 2010
    Posts
    51
    Rep Power
    3

    Default outer loop in C

    Hi. I am last year BSc(I.T) student am learning c programming language. I want to know about how to break outer loop from switch case? Any help would be highly appreciated. Thanks in advanced. Here is my code:
    Code:
    for(int a=0;a<15;a++)
    {
        switch(a)
        {
        case 6:
        break;
        case 7:
       
        }
    }

  2. #2
    Join Date
    Feb 2010
    Posts
    46
    Rep Power
    0

    Default

    I suggest you to refer following example of Switch(in a) condition, which will give you something idea about the use of this condition:
    Code:
    for(int k=0;k<15;k++)
    {
       if (!DoSwitch(k))
           break;
    }
    
    bool DoSwitch(intk)
    {
     switch(k)
        {
        cases 6:
          return true;
        cases 7:
          return false;
        }
    }

Similar Threads

  1. Java for loop example
    By WilsonMartin in forum Programming
    Replies: 1
    Last Post: 02-10-2010, 01:12 PM
  2. loop to get particular pattern
    By FosterWood in forum Programming
    Replies: 1
    Last Post: 01-30-2010, 01:39 PM
  3. Differentiate between Do-While loop and While loop
    By RussellBarnes in forum Programming
    Replies: 1
    Last Post: 01-14-2010, 06:27 PM
  4. Problem in my loop
    By sara fisher in forum Programming
    Replies: 3
    Last Post: 10-21-2009, 12:03 PM
  5. using The Loop Function
    By jack879 in forum Everything Else
    Replies: 0
    Last Post: 11-17-2008, 12:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48