【初心者歓迎】C/C++室 Ver.44【環境依存OK】
at TECH
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