【初心者歓迎】C/C++室 Ver.44【環境依存OK】 at TECH
[2ch|▼Menu]
328:デフォルトの名無しさん
07/11/15 01:59:11
>>324
配列要素数を超えたところを指すようにポインタに足し算すると未定義動作になる。

C99 6.5.6 p8 より( C++ では 5.7 p5 に同じ文面がある)
> If both the pointer operand and the result point to elements of the same array object, or one past the last element
> of the array object, the evaluation shall not produce an overflow; otherwise, the behavior is undefined.

この場合だと要素数 2 の char 配列とみなせるから、 2 までは大丈夫で 3 以上でアウトね。


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4987日前に更新/97 KB
担当:undef