patterncMinor
Why is the address-of operator in C/C++ represented with the "&" symbol?
Viewed 0 times
representedwhytheaddressoperatorwithsymbol
Problem
I've started learning C++, and I know a little bit of C. Something that always struck me as somewhat off was that the address-of operator is represented with the seemingly random ampersand (&) symbol instead of, say, the "at" symbol (@). Is there some kind of history behind this?
Solution
Because B did!
A user on software engineering.sx contacted Ken Thompson:
From: Ken Thompson
c copied from b so & and * are same there.
b got * from earlier languages - some assembly,
bcpl and i think pl/1.
i think that i used & because the name (ampersand)
sounds like "address." b was designed to be run with
a teletype model 33 teletype. (5 bit baud-o code)
so the use of symbols was restricted.
A user on software engineering.sx contacted Ken Thompson:
From: Ken Thompson
c copied from b so & and * are same there.
b got * from earlier languages - some assembly,
bcpl and i think pl/1.
i think that i used & because the name (ampersand)
sounds like "address." b was designed to be run with
a teletype model 33 teletype. (5 bit baud-o code)
so the use of symbols was restricted.
Context
StackExchange Computer Science Q#137032, answer score: 5
Revisions (0)
No revisions yet.