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

a question

Name: Anonymous 2012-01-09 11:02

This was asked to me in an interview. I am wondering how many of you know this

What is the type of the addition of an unsigned and a signed integer in C?

Name: Anonymous 2012-01-10 4:38

>>20

yeah, if you are going to store pointers to functions that have varrying call signatures or return types, then you might want to use a structure instead:


struct my_awesome_function_table {
  void (*blah)(int x);
  void (*meep)(int k, int f, char e);
  void (*meta)(struct my_awesome_function_table* this, void* userdata);
};


But if you wanted to store them in an array, you could use an array of void pointers, and cast the pointer when you call the function it points to


int dicks(int c, char k) {
}
  return (c & k) | (c & (k<<2));

int f() {
  void* fn = dicks;
  int c = ((int(*)(int,char))fn)(56, 'a');
  return c;
}

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