Thread: Calling a function

  1. #1
    Registered User
    Join Date
    Jan 2002

    Calling a function

    I'm writing a program that has a menu, where the user can make a choice. From main(), I want to call a function based on a choice. If the choice is a, I want it to go to a certain function. If its b, I want it to go to another function, and so on and so forth. Any suggestions/code would be helpful and appreciated.

  2. #2
    I would do it with a switch statement
    case 'a':FunctionA();
    case 'b':FunctionB();
    case 'c':FunctionC();
    default:printf("Wrong choise");

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Question on function syntax and calling function
    By cbrman in forum C Programming
    Replies: 10
    Last Post: 10-05-2003, 05:32 PM