LoginSignup
10
5

More than 5 years have passed since last update.

void (*signal(int sig, void (*func)(int)))(int);

Posted at

C標準ライブラリが提供する関数のうち、最も複雑なプロトタイプ宣言について。ちゃんと解読できますか?

signal.h
void (*signal(int sig, void (*func)(int)))(int);

cdecl.org

複雑な型宣言で困った時は https://cdecl.org/ に頼ってみましょう... で済ませたかったのですが、少しだけ加工してあげないとダメなようです。

void (*signal(int, void (*)(int)))(int);

declare signal as function (int, pointer to function (int) returning void) returning pointer to function (int) returning void

はい。日本語で書き下すと:

引数に『int型と「引数にint型をとりvoid型を返す関数へのポインタ型」』をとり「引数にint型をとりvoid型を返す関数へのポインタ型」を返す関数signalの宣言

ね、簡単でしょう?

ちゃんとした解説は下記ページを参考にください:

10
5
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
5