In C position of ++ in regards to pointers -
so code runs differently when have: *ptr++; , ++*ptr
i know part ++ being in front add first , when in add @ end. pointer increment @ end of method. clarify i'm trying move pointer next character. character type pointer.
*ptr++ processed *(ptr++); increments ptr returns original value, dereferenced.
++*ptr processed ++(*ptr) dereferences pointer, increments value points to (not pointer).
to preincrement pointer, value @ incremented location, want *++ptr, increments pointer, dereferences @ new location.
Comments
Post a Comment