Open main menu

CDOT Wiki β

Changes

C/C++ FAQ

2 bytes removed, 15:17, 19 September 2012
no edit summary
<br>
'''Q:''' When using square-bracket pointer arithmetic, does ptr[-k] decrement the pointer?<br>
'''A:''' Yes. 'ptr' is the address of an element of the array; the array's element size is multiplied by the value of 'k', negated by '-', and then 'added' to the address stored in 'ptr'. ptr[-k] moves to the element 'k' elements earlier than the element pointed to by ptr.