Sponsored Content
Full Discussion: CallFunc !
Top Forums Programming CallFunc ! Post 96362 by linuxpenguin on Thursday 19th of January 2006 11:49:51 AM
Old 01-19-2006
int * (CallFunc)(int a,int b);
is not a function pointer, it is just a function that returns a pointer to an int.

however, int (*CallFunc)(int a, int b) is a function pointer meaning any function that returns an int and takes 2 integers as an argument can be pointed by CallFunc.

for eg, if you have int fn(int, int), then CallFunc = fn is valid statement and calling (CallFunc)(int) will actually result in execution of fn. Further down if you assign CallFunc = fn2 where fn2 is of type int fn2(int, int), and then you call (CallFunc)(int), you actually call fn2.

going further ahead you can have an array of this pointer and make its individual element point to varying functions.

check http://www.geocities.com/hemantborole/
click on KnowledgeBank, C (under my programs), and in the list see the fnptr.c and func_ptr.c programs.
they are not pointers in structure, but they are function pointers and you can happily put them as a member of a structure.
 
Ns_Url(3aolserver)					   AOLserver Library Procedures 					Ns_Url(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_AbsoluteUrl, Ns_ParseUrl, Ns_RelativeUrl, Ns_SkipUrl - URL manipulation routines SYNOPSIS
#include "ns.h" int Ns_AbsoluteUrl(Ns_DString *pds, char *url, char *baseurl) int Ns_ParseUrl(char *url, char **pprotocol, char **phost, char **pport, char **ppath, char **ptail) char * Ns_RelativeUrl(char *url, char *location) char * Ns_SkipUrl(Ns_Request *request, int n) _________________________________________________________________ DESCRIPTION
Ns_AbsoluteUrl(pds, url, baseurl) Construct an URL based on baseurl but with as many parts of the incomplete url as possible. Return NS_OK or NS_ERROR. Ns_ParseUrl(url, pprotocol, phost, pport, ppath, ptail) Parse a URL into its component parts. Pointers to the protocol, host, port, path, and "tail" (last path element) will be set by ref- erence in the passed-in pointers. The passed-in url will be modified. Ns_RelativeUrl(url, location) If the url passed in is for this server, then the initial part of the URL is stripped off. e.g., on a server whose location is http://www.foo.com, Ns_RelativeUrl of "http://www.foo.com/hello" will return "/hello". Returns a pointer to the beginning of the relative url in the passed-in url, or NULL if error. Will set errno on error. Ns_SkipUrl(request, n) Return a pointer n elements into the request's url. SEE ALSO
nsd(1), info(n) KEYWORDS
AOLserver 4.0 Ns_Url(3aolserver)
All times are GMT -4. The time now is 01:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy