Thread: restarting main

  1. #1
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003

    restarting main

    I have some code like this

    int main(int argc, *argv[]) {

    i want to know how to restart the main function from inside of main

    like this,

    int main(int argc, *argv[]) {
    main(argc, ???);

    what would i put so that all the args in that array are still transfered?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Don't ever call main. Redesign your program, because if you need to call main, you're doing it all wrong.

    Hope is the first step on the road to disappointment.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    If you're going for the recursive solution, make sure you're absolutely sure how recursion works or you may experience stack overflows (the program mysteriously crashing after a while).

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  2. confused about adding controls to main window
    By terracota in forum Windows Programming
    Replies: 4
    Last Post: 11-24-2004, 12:35 PM
  3. Int Main or Void Main?
    By FromHolland in forum C++ Programming
    Replies: 9
    Last Post: 06-12-2003, 04:29 PM
  4. int main (), main (), main (void), int main (void) HELP!!!
    By SmokingMonkey in forum C++ Programming
    Replies: 7
    Last Post: 05-31-2003, 09:46 PM
  5. void or int for main?:)
    By bigtamscot in forum C Programming
    Replies: 13
    Last Post: 09-27-2001, 03:11 AM