Thread: problem with switches and loops

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    2

    Question problem with switches and loops

    i cant figure out why this prog crashes
    it doesnt exit or anything, but it just keeps repeating the information its supposed to say

  2. #2
    Registered User
    Join Date
    May 2002
    Posts
    2

    Post

    Please Note:
    the program is being run under Windows at a DOS command prompt

  3. #3
    Unregistered
    Guest

    Red face

    In C, your program can not be allowed to make
    recursive call with main() function.
    Only OS is allowed to call your program's main()
    function. So remove the call main() in default
    of switch statement.
    Good luck
    DV007

  4. #4
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    1. It's not compiling on my system (need to include process.h).
    2. Use int main(void) and return something!
    3. Don't call main in main. This is wrong!
    4. Don't use while(1), use while(c != 'x' && c != 'X')

  5. #5
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Originally posted by Monster
    use while(c != 'x' && c != 'X')
    This must be: while((char)c != 'x' && (char)c != 'X')

    Cheers, Monster

Popular pages Recent additions subscribe to a feed