pointer arithmetic

C++์˜ ํฌ์ธํ„ฐ๋Š” Assignment Expressions (๋Œ€์ž… ํ‘œํ˜„์‹) Arithmetic Expressions (์‚ฐ์ˆ  ํ‘œํ˜„์‹) Comparison Expressions (๋น„๊ต ํ‘œํ˜„์‹) ์—์„œ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ํฌ์ธํ„ฐ์— ๋Œ€ํ•œ ๋‹ค์–‘ํ•œ ์—ฐ์‚ฐ(์‚ฐ์ˆ )์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ํฌ์ธํ„ฐ์— ์ ์šฉ ๊ฐ€๋Šฅํ•œ ๋ช‡๊ฐ€์ง€ ์—ฐ์‚ฐ๋“ค์ž…๋‹ˆ๋‹ค. (++) ํฌ์ธํ„ฐ์˜ ๊ฐ’์„ ์ฆ๊ฐ€์‹œ์ผœ ๋ฐฐ์—ด์˜ ๋‹ค์Œ ์š”์†Œ๋ฅผ ๊ฐ€๋ฅดํ‚ค๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. int_ptr++; (--) ํฌ์ธํ„ฐ์˜ ๊ฐ’์„ ๊ฐ์†Œ์‹œ์ผœ ๋ฐฐ์—ด์˜ ์ด์ „ ์š”์†Œ๋ฅผ ๊ฐ€๋ฅดํ‚ค๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. int_ptr--; (+) ํฌ์ธํ„ฐ์˜ ๊ฐ’์„ n * sizeof(type) ๋งŒํผ ์ฆ๊ฐ€์‹œํ‚ต๋‹ˆ๋‹ค. int_ptr += n; or int_ptr = int_ptr + n; (-) ํฌ์ธํ„ฐ์˜ ๊ฐ’์„ n * sizeof(type) ๋งŒํผ ๊ฐ์†Œ์‹œํ‚ต๋‹ˆ๋‹ค. i..
Chan Lee
'pointer arithmetic' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก