c - Discarded 'const' qualifier at assignment -


i have following code -

int acb(const uint16 *msgptr)  {  uint16 *p = (msgptr + 1); printf("%d", *p);  } 

i following warning - discarded 'const' qualifier @ assignment line above printf. how resolve?

the argument acb pointer constant uint16, pointer you're creating not pointing constant. discards const qualifier. either remove const argument passed function or make p point const uint16.

why case? tell compiler guarantee won't change msgptr points to, create pointer can modify msgptr points *(p - 1) = ...;


Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -