[TUHS] C declarations.

Dave Horsfall dave at horsfall.org
Fri May 12 09:44:40 AEST 2017

On Thu, 11 May 2017, Arthur Krewat wrote:

> But wouldn't that imply you didn't need to use the * when referencing 
> the actual value?
> For example, if you do this:
> char *p;
> char c;
> The correct way to get the character it's pointing to dereference like 
> this:
> c=*p;
> If the type was char* (not char)
> Wouldn't that imply I wouldn't need the * to dereference the pointer?

No, because you'd be assigning the contents i.e. the address (or however 
references are implemented on a given architecture) to a character; 
whether the fundamental type is "char*" or ("mostly char but it's really a 
pointer") is the same.

Then again, I learned ALGOLW (and PASCAL) before I learned C, and it has a 
"REFERENCE" type...

Dave Horsfall DTM (VK2KFU)  "Those who don't understand security will suffer."

More information about the TUHS mailing list