Thread: One very dumb question.

  1. #1
    Registered User
    Join Date
    Aug 2014
    Posts
    2

    One very dumb question.

    How do I stop my program from exiting in C?

    I tried some things like:

    return 0;
    system ('PAUSE');

    the thing i do is put a scanf(); at the end and he waits an input but that looks terrible.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    in your example, the call to system() will never happen, because you're returning before you get there. If you put the "return 0" after the system() call, it will work as you expect. Return is unconditional. Nothing gets executed after a return statement.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #3
    Registered User
    Join Date
    Aug 2014
    Posts
    2
    Thanks!

  4. #4

  5. #5
    Registered User zub's Avatar
    Join Date
    May 2014
    Location
    Russia
    Posts
    104
    Run program in command line.
    Our goals are clear, tasks are defined! Let's work, comrades! -- Nikita Khrushchev

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dumb question
    By travis999 in forum C Programming
    Replies: 3
    Last Post: 10-26-2007, 12:57 AM
  2. dumb question?
    By davelair27 in forum C Programming
    Replies: 6
    Last Post: 10-11-2006, 06:10 AM
  3. Dumb fan question
    By RoD in forum Tech Board
    Replies: 20
    Last Post: 02-14-2003, 12:53 PM
  4. Sorry for a dumb question.
    By Vanished in forum C++ Programming
    Replies: 7
    Last Post: 11-23-2002, 12:39 PM
  5. really dumb question....
    By DJTris in forum C++ Programming
    Replies: 8
    Last Post: 12-01-2001, 01:44 PM

Tags for this Thread