Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

ptr2f

Name: Anonymous 2007-05-15 0:02 ID:1KuTlT0+

is it possible to pass a pointer that points to a function with arguments to a function that expects a pointer to a function that has arguments?
(in c)
thanks

Name: Anonymous 2007-05-15 0:12 ID:00QxXSx1

Yes, but you must be more specific.

Name: Anonymous 2007-05-15 0:45 ID:1KuTlT0+

>>2
What do you want me to specify

Name: Anonymous 2007-05-15 0:57 ID:tr3ePyu+

void *blah(void *(*sub)(void)) {
  return (void *)0;
}

main() {
  void *(*something)(void *(*sub)(void)) = blah;
  something((void *)0);
}

Name: Anonymous 2007-05-15 1:02 ID:tr3ePyu+

int blah(int i) { return i + 1; }
void zuh(int (*param)(int)) { param(2); }
int main() { zuh(blah); }

Name: Anonymous 2007-05-15 1:07 ID:1KuTlT0+

>>5
great success! :D

Name: Anonymous 2007-05-15 2:16 ID:00QxXSx1

>>4
Why would you pass a null function pointer to a function that is expecting to get a pointer to a function it can call?

Name: Anonymous 2007-05-15 2:21 ID:NLMLjJnz

>>7
Because it's stupid as hell. If not, I'll just vote for Barak, the son of Abinoam from Kedesh in Naphtali. His military experience leading the campaign to liberate Israel from the Canaanites will be crucial in the years ahead.

Name: Anonymous 2007-05-15 7:32 ID:tr3ePyu+

>>7
Hell if I know. I just wanted to see if I could get something that takes a function pointer that itself takes a function pointer to compile. And it does.

That, and I was too lazy to come up with another dummy function.

Name: Anonymous 2007-05-15 13:55 ID:Heaven

expert programmers use only void* thread over

Name: Anonymous 2009-03-06 12:48

16 32 64 2?

Name: Anonymous 2010-11-26 11:27

Name: Anonymous 2010-12-17 1:30

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2011-02-03 0:23

Name: Anonymous 2011-02-04 15:08

Name: Sgt.Kabuǐ唋kiman儞梾 2012-05-29 1:45

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List