--- In [email protected], knowledge seeker <knowledgeseeke...@...> wrote:
> Sharma, Hans Raj (London)<hansraj_sha...@...> wrote:
> > That clears my concept. Just one doubt, are you talking
> > about CPU registers below? Can we get address of them? How?
>
> A pointer is a pointer.

It's hard to argue with that.

> do a sizeof on char ptr, do a sizeof on int ptr,
> you will see that both are same on a system,

That I can argue with.

The C language requires void and character pointers to
have the same representation, hence the same size. It
also requires struct and union pointers to all have
the same representation, though not necessarily the
same size as void pointers. There is no other
requirement regarding the size of different pointer
types.

IIRC, C++ does not add any additional restraints.

> which is equal to the sizeof system - word.

Define 'system - word'.

> also a hex literal like 0x123 is inherently a unsigned
> int literal.

No, it isn't.

  "The type of an integer constant is the first of the
  corresponding list in which its value can be represented.
  ... unsuffixed octal or hexadecimal: int, unsigned int,
  long int, unsigned long int; ..."

Unsuffixed 0x123 and 0x1234 are both in the range of int,
hence they have type int.

> unsigned char* ptr just states the behavior when its
> dereferenced.

In a sense, but that doesn't seem to address the OP's
question.

-- 
Peter

Reply via email to