How to use type

xiaoxiao2021-03-05  22

Use an esample to indeicate. Given,

Void (* Signal (int SIGNAL (INT)) (INT);

(You Call Signal () And Pass It Arguments to Say Which Interrupt You Are Talking About, And Which Routine Should Be Invoked To Handle It.)

Firstly, Drop The Arguments of Signal and this Means,

Void (* signal ()) (int);

And One Funny Argument IS,

Void (* func) (int);

Func is a pointer to a function taking an int Argument and return void.

Here's How The Signal Can Be Simplified As Follow, SIMPLIFIED AS FOLLOW

TYPEDEF VOID (* PTR_TO_FUNC) (INT);

/ *

* This Says That PTR_TO_FUNC IS A POINTER TO A FUNCTION

* That takes an int Argument, And Returns Void

* /

PTR_TO_FUNC SIGNAL (int, PTR_TO_FUNC);

/ *

* This Says That Signal IS A Function That Takes

* Two arguments, an int AND a PTR_TO_FUNC, AND

* RETURNS A PTR_TO_FUNC

* /

转载请注明原文地址:https://www.9cbs.com/read-38595.html

New Post(0)