Thread: pointers to funtions

  1. #1
    Registered User
    Join Date
    Nov 2010

    Question pointers to funtions

    i have this code

    #include <stdio.h>
    #include <iostream>
    using namespace std;
    void DisplayMine()
    	cout <<"dgd";
    struct mine
    	void (*dd)(void);
    int main()
        void (*foo)(int);
    	mine  mineTmp[10];
    	mineTmp[0].dd = &DisplayMine;
    	system ("pause");
        return 0;

    what i want to do is load differnet pointers to different funtions in an array .
    then just call the funtion by going something like mineTmp[1];

    its for finite state machine , i figure you can do this some how , can ayone tell me how to do this please

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Katy, Texas
    Try this:
    mineTmp[0].dd = DisplayMine;
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Arrays with pointers
    By Niels_M in forum C Programming
    Replies: 18
    Last Post: 07-31-2010, 03:31 AM
  2. size of struct with pointers and function pointers
    By sdsjohnny in forum C Programming
    Replies: 3
    Last Post: 07-02-2010, 05:19 AM
  3. Replies: 7
    Last Post: 05-19-2010, 02:12 AM
  4. pointers to arrays
    By rakeshkool27 in forum C Programming
    Replies: 1
    Last Post: 01-24-2010, 07:28 AM
  5. Staticly Bound Member Function Pointers
    By Polymorphic OOP in forum C++ Programming
    Replies: 29
    Last Post: 11-28-2002, 01:18 PM