c - understanding pointers in a function argument -


in code below, explain second argument is? "constant pointer data".

thanks

const uint8_t *const data means function not able update either data parameter or object points . iow, can't set data point different object within function.

in short:

const t *p           -- p writable, *p not t const *p           -- same above t * const p          -- *p writable, p not const t * const p    -- neither p nor *p writable t const * const p    -- same above  

edit

note change data wouldn't reflected in calling function (unlike change *data), why bother making const? typically it's because function body needs preserve pointer throughout execution; iow, if accidentally update data you'd break later on in function. way guarantee such changes can't happen.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -