Martin Jørgensen said:
When you point to a location in memory, that is "void * ptr1;" and
then point to the next location, that is ptr[1] or something, then the
difference between ptr2-ptr1 is CHAR_BIT = 1 byte ?
Not exactly. If ptr is of type void*, then the expression ptr[1] is
illegal; you can't dereference or do arithmetic on a void*. You can
convert ptr to some other pointer type and do arithmetic on it, but
then the "stride" is determined by what the other pointer type points
to.
The standard guarantees that void* and char* have the same
representation, <OT>and gcc allows arithmetic on void* as an extension
(a bad idea IMHO)</OT>, so you can sort of think of void* as a byte
pointer. But it's usually better to to think of void* as a generic
pointer type. The equivalence of void* and char* is a relic of older
versions of the language; before the C89 ANSI standard, there was no
void*, and char* served as generic pointer type.
So 1 byte = CHAR_BIT bits, that is the minimum size you can address
besides registry flags?
I'm not sure what you mean by "registry flags", but they're not
something you can access from standard C. Bit fields can be accessed,
and can be as small as 1 bit, but you can only assign to them and
refer to their values; you can't take the address of a bit field.