Linked Questions

20 votes
4 answers
15k views

I let gcc compile the following example using -Wall -pedantic: #include <stdio.h> int main(void) { printf("main: %p\n", main); /* line 5 */ printf("main: %p\n", (void*) main); /* line 6 */ ...
alk's user avatar
  • 71.2k
4 votes
8 answers
7k views

qsort(bt->rw[t], bt->num[t], sizeof(TRELLIS_ATOM *), (int (*)(const void *,const void *))compare_wid); bt->rw[t] is a pointer to struct pointer, bt->[num] is an int, I don't ...
moeness86's user avatar
2 votes
2 answers
8k views

Suppose I have a function void myFun(int*) In C++ what exactly does the following mean ( void(*)(void*) )&myFun Is it a pointer to a function that takes a (void*) as an argument and returns a ...
Mykie's user avatar
  • 173
5 votes
2 answers
2k views

Suppose I have functions: void func1(int x) { .... } void func2(int x, int y) { .... } void func3(int x, int y, int z) { .... } And say that I want to have a function pointer within a ...
user1128265's user avatar
  • 3,059
1 vote
3 answers
2k views

I want to create a function prototype in C++ so that there is a void * argument that can take pointers of any type. I know that this is possible in C. Is it possible in C++? [EDIT] Here is a ...
vy32's user avatar
  • 30.1k
2 votes
2 answers
2k views

I have a back end function that returns a void pointer (void*) and I have several front end function pointers that point to it. Each front end function pointer however needs to return a different type ...
JackCarmichael's user avatar
1 vote
2 answers
1k views

I am trying to analyze what happening to the extra or less parameters that are supplied to the function pointers which are not of compatible size (Less or more arguments). Consider the below example ...
Suman's user avatar
  • 4,251
6 votes
3 answers
500 views

Can you cast a function pointer of this type: void (*one)(int a) to one of this type: void (*two)(int a, int b) and then safely invoke the pointed-to function with the additional arguments(s) it has ...
Pete's user avatar
  • 61
2 votes
2 answers
319 views

Why am I able to assign a function that returns an int with no parameters specified to a function pointer that returns an int but takes an int argument? For example when I do: int f() { return 0;} ...
zero cola's user avatar
2 votes
4 answers
212 views

EDIT2: It seems that the standard is not exactly clear, and appears to at least partially contradict itself in different parts on the usage of void* or struct* when casting function pointers. The lack ...
Oliver Schönrock's user avatar
3 votes
1 answer
195 views

I observed the usage of objc_msgSend to send messages to Objective-C IDs from pure C. The usage is not well documented but I found an example here. What I am confused by is the function pointer is ...
CPlus's user avatar
  • 5,110
1 vote
1 answer
246 views

Given the following declaration for a function used to update a node in a doubly linked list: uint8 dl_update(DL_LIST **node, uint16 new_tag, void *new_object, uint32 new_size, void (*destructor)(...
RBE's user avatar
  • 183
1 vote
0 answers
259 views

Possible Duplicate: Casting a function pointer to another type int primes[] = {11, 5, 3, 7, 19, 13, 2, 17}; int comp(const int*, const int*); qsort(primes, 8, sizeof(int), (int(*)(const void*, ...
fredoverflow's user avatar
0 votes
2 answers
241 views

In my code I'm trying to use dummy objects to perform modularity in C. At the moment I specify important function useful for every objects via function pointers, like destructors, toString, equals as ...
Koldar's user avatar
  • 1,437