explain a prototype of function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kalar
    New Member
    • Aug 2007
    • 82

    #1

    explain a prototype of function

    Hello!!!
    I have to write a function and they are giving me the prototype of the function, but i don't understand what arguments takes.
    the prototype is:
    Code:
    coroutine *co_start(void (*body) (void*), void *attr);
    can you explain me what arguments take this function and what returns?
    I am really confused.
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Can you post your best guess to that? I would recommend breaking it down into parts:

    1) what does the function return?
    2) what are parameters passed?
    3) what types are the parameters being passed?

    You can also google search for help.

    Comment

    • kalar
      New Member
      • Aug 2007
      • 82

      #3
      coroutine *co_start(void (*body) (void*), void *attr);

      coroutine *co_start . This means that i should make a function co_start that returns a pointer to coroutine.

      void (*body) (void*) is one of the arguments of the function.This argument is a pointer to a function body.This function takes as argument a pointer to void.

      the second argument void *attr of the function co_start is a pointer to void.
      Right???

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by kalar
        coroutine *co_start(void (*body) (void*), void *attr);

        coroutine *co_start . This means that i should make a function co_start that returns a pointer to coroutine.

        void (*body) (void*) is one of the arguments of the function.This argument is a pointer to a function body.This function takes as argument a pointer to void.
        ... and that function returns nothing (void).

        Originally posted by kalar
        the second argument void *attr of the function co_start is a pointer to void.
        Right???
        Right.

        kind regards,

        Jos

        Comment

        Working...