10
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C言語Advent Calendar 2017

Day 23

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の宣言

[ね、簡単でしょう?][bobross]
[bobross]: https://dic.pixiv.net/a/%E3%81%AD%E3%80%81%E7%B0%A1%E5%8D%98%E3%81%A7%E3%81%97%E3%82%87%3F

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

10
4
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
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?