1
typedef long (*GuiFunc) (int, int, int, unsigned short*, long, long);

Please help me understand the above line of code

3 Answers3

1

you are defining a new type here.

The new type here is a function pointer.

the function pointer has 6 input arguments

MOHAMED
  • 41,599
  • 58
  • 163
  • 268
1

You define a type GuiFunc which is a pointer (that's that (*GuiFunc) construct) to a function (the stuff in parentheses) which takes 3 ints, a pointer to unsigned short, two longs and returns a long.

Alexander L. Belikoff
  • 5,698
  • 1
  • 25
  • 31
  • I know from text book knowledge that : typedef int dog; dog counter; counter = 5; that's how it goes. Now does the line of code mean that I am using a function pointer in place of long? – user2655793 Oct 08 '13 at 14:27
  • No, that's a special syntax for typedefs for function pointers. C language is not very regular in its declarations. – Alexander L. Belikoff Oct 08 '13 at 14:51
1
typedef long (*GuiFunc) (int, int, int, unsigned short*, long, long);  

Defines new type GuiFunc.that can declare a function pointer which takes 6 parameters int, int, int, unsigned short*, long, long and returns long.

Assume you have a function like this

long foo(int, int, int, unsigned short*, long, long)
{

}

if you declare

Guifunc callback; //declare a varaible of type Guifunc
callback=foo;

then you can call foo function like this long x=callback(6parameters);

Gangadhar
  • 10,248
  • 3
  • 31
  • 50