switch{}

This is a discussion on switch{} within the C Programming forums, part of the General Programming Boards category; if I use return() inside a switch statement, will I return out of the function that the switch is in, ...

  1. #1
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463

    switch{}

    if I use return() inside a switch statement, will I return out of the function that the switch is in, or will I only exit the switch statement?

  2. #2
    Registered User Sargnagel's Avatar
    Join Date
    Aug 2002
    Posts
    166
    The keyword return causes program flow to exit from the current function and return to the calling function.
    If you want to exit the switch statement only, you can use break.
    Last edited by Sargnagel; 05-04-2003 at 11:13 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. ascii rpg help
    By aaron11193 in forum C Programming
    Replies: 18
    Last Post: 10-29-2006, 01:45 AM
  3. Switch
    By cogeek in forum C Programming
    Replies: 4
    Last Post: 12-23-2004, 06:40 PM
  4. Switch Case
    By FromHolland in forum C++ Programming
    Replies: 7
    Last Post: 06-13-2003, 04:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21