【ISO/ANSI/JIS】 C言語なら俺に聞け! Part 132
■ このスレッドは過去ログ倉庫に格納されています
0756デフォルトの名無しさん
2008/01/08(火) 03:08:19「malloc(size)も確保したものが配列である」なんて書き方がしてあるところはないだろうけど、
ちょっと探してみる。
とりあえず 6.5.6 Additive operators から
> For the purposes of these operators, a pointer to an object that is not an element of an
> array behaves the same as a pointer to the first element of an array of length one with the
> type of the object as its element type.
加算演算子の振舞いについて、配列要素でないオブジェクトへのポインタは、要素数1の
配列要素を指すポインタと同様に振舞う、とされている。
これから考えても >752 の a が int [1] を指してると言っても問題ないだろうね。
そうなると複数要素の配列のときだけダメなんてルールになってるわけないと思う。
■ このスレッドは過去ログ倉庫に格納されています