Cのポインタの読み方は、ルールを知らないと摩訶不思議です。
ルールを覚えれば、
int (*p[5])[3];
char (*(*fp)(void))(int);
なんてのも解読する事ができます。
—- 大事な前程
ポインタを読む際には、「英語で読む」必要があります。
「え~、英語~」 と思う方もいるかもしれませんが、逆に日本語で読む方が大変です。
—- 基本ルール
ルール
後置演算子が優先。
関数の()
配列の[]
前置はあとで。
要は、「後ろに何かあったら、後ろが優先」です。
演算子の英語での読み方
* pointer to …
() function returning …
[] array of …
なるほど。普段は無意識に後置優先読みをしていたのだが、それを英語で置き換えて読めば一発だね。
(via kashino)
-
gogatsu26 liked this
-
whatta reblogged this from kashino
-
qawsklp reblogged this from toby-net and added:
kashino)うげぇ
-
qawsklp liked this
-
shino reblogged this from kashino
-
logic-rythm liked this
-
hoge77 liked this
-
kenta0101 reblogged this from atm09td
-
take-cheeze liked this
-
hanatosora liked this
-
haguy reblogged this from atm09td
-
bokuwabokudayo reblogged this from muratayusuke
-
noonoon reblogged this from mamemomonga
-
layzie313 reblogged this from toby-net
-
hugakusan reblogged this from yt-siden
-
yt-siden liked this
-
yt-siden reblogged this from jun26
-
takashi0215 liked this
-
takashi0215 reblogged this from atm09td
-
takashi0215 reblogged this from atm09td
-
shineon964 reblogged this from toby-net
-
coro365 liked this
-
seapomeranian reblogged this from atm09td
-
gonfreak reblogged this from kashino
-
muratayusuke reblogged this from atm09td
-
watarumohawk liked this
-
readmaster reblogged this from toby-net
-
mamemomonga reblogged this from jun26
-
ishuushi liked this
-
atm09td reblogged this from toby-net
-
functionn reblogged this from kashino
-
jun26 reblogged this from toby-net
-
toby-net reblogged this from kashino
-
nag liked this
-
nag reblogged this from kashino
-
kemomimilove liked this
-
shayol reblogged this from kashino
-
whatta liked this
-
ykhs liked this
-
8ue reblogged this from kashino
-
foloinfo liked this
-
naozine reblogged this from kashino
-
gijibamboo reblogged this from kashino
-
tuxedocat liked this
-
afbcr808 liked this
-
kiyoya liked this
-
yukemuriippai liked this
-
timbalero liked this
-
ukar reblogged this from kashino
-
kashino posted this
- Show more notes
Short URL for this post: http://tmblr.co/Zu2ELyEw00qw