The rules are simple:
- each type of pointer (except function pointers) can be dropped to and from void * without loss.
- you cannot do pointer arithmetic on void * pointers and you cannot dereference them
- sizeof (char) is 1, by definition; therefore incrementing the char pointer means "adding 1" to the "raw" value of the pointer
From this, you can conclude that if you want to perform raw pointer arithmetic, you must cast to and from char *.
wildplasser
source share