restarting main

This is a discussion on restarting main within the C Programming forums, part of the General Programming Boards category; I have some code like this int main(int argc, *argv[]) { ... } i want to know how to restart ...

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

    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
    Posts
    14,826
    Don't ever call main. Redesign your program, because if you need to call main, you're doing it all wrong.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    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).
    MagosX.com

    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, 05: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, 10:46 PM
  5. void or int for main?:)
    By bigtamscot in forum C Programming
    Replies: 13
    Last Post: 09-27-2001, 04:11 AM

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