[TUHS] C declarations.

Richard Tobin richard at inf.ed.ac.uk
Sat May 13 00:04:45 AEST 2017


> The problem with that is that * doesn't really bind to the type name. 
> It binds to the variable.
> 
> char* cp1, cp2;   // cp1 is pointer to char,   cp2 is just a char.
> 
> I always found it confusing that the * is used to indicate an pointer
> here, where as when you want to change an lvalue to a pointer, you use
> &.

The way to read it is that you are declaring *cp1 as a char.

-- Richard

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the TUHS mailing list