🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.c++.moderated
1 messages
1 total messages Started by Kevin Lew Sun, 24 Mar 1996 18:32
How do I return a function pointer?
#64
Author: Kevin Lew
Date: Sun, 24 Mar 1996 18:32
42 lines
2095 bytes
{The following is just a duplicate of an article I just rejected with
an corresponding comment. Note that articles posted to a moderated
newsgroup do not appear immediately, as they need a moderator to
approve it. Also, after this is done, the article as to be distributed
which also takes some time. -mod}

POST
X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.5 sun4c)
To: kev@cs.adelaide.edu.au

Hello there everyone,

Thanx for reading me. I have a function which needs to return a pointer
to a function but unfortunately I dont know how the header should be
like. get_fn (see below) takes a char* argument and must return a
pointer to a function taking no arguments and return an int. I tried
both
	(int(*)()) get_fn(char* name) { // code here }
and
	int(*)() get_fn(char* name) { // code here }

I also tried

	typedef int(*)() fnptr;

	fnptr get_fn(char* name) { // code here }

but nothing works, any help? Please email me because I don't regularly
read the news.

Kevin

-- 
Kevin C F Lew                    ,-_|\     email: kev@cs.adelaide.edu.au
Department of Computer Science  /     \             phone: (08) 303 4728
University of Adelaide          \_,-*_/               fax: (08) 303 4366
South Australia 5005                 v       www.cs.adelaide.edu.au/~kev

      [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
      [  Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm  ]
      [  Moderation policy: http://www.connobj.com/cpp/guide.htm  ]
      [      Comments? mailto:c++-request@netlab.cs.rpi.edu       ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads