I\'ve read a paragraph but I can\'t understand what does it mean....can anyone please explain? the paragraph is :
processing a single character as a cha
It means you shouldn't do something like:
char *pCh = 'A'; // this is the value 0x41 (assuming ASCII).
char Ch = *pCh; // probably not what you wanted.
because there is a vast difference between a character and a character pointer.
In fact, a decent compiler should give you a warning when you attempt to do something like that.
The rest of it explains one possible effect. If you're working in a system where char
values are eight bits, they will only be able to hold values from 0 through 255 inclusive (the ISO C standard allows char values to be larger but it's fairly uncommon). It's very unlikely that a pointer chosen at random from that value set will be useful.
It's not totally out of the question since you may be on an embedded system where you have memory-mapped I/O down there but, in that case, you'd be more likely to use something like #define IOPORT7 0x0041
and use IOPORT7
rather than 'A'
.
Pointers, on the other hand, tend to be able to point at your entire address space, which can be 32 bits wide (or larger). 32 bits gives you about four billion possible values where a pointer can point to.