In this post, we will see how to resolve incrementing unsigned char *image
Best Answer:From the code it is evident that the pointer points to an element of an array of
image[i]is equivalent (really equivalent, that is how it is defined) to
*(image + i), ie it increments the pointer by
iand dereferences it. You can write
imageto get the element
imagepoints to. You can type
imageto get the next element in the array.
Lets call the actual array
xthen you can access its elements via incrementing
offsetin the outer loop which increments by 3 in each iteration and then instead of
image[ i ]they would have used
image[ i + offset ]. Instead they choose to increment
imagewhich has the same effect.
If you have better answer, please add a comment about this, thank you!