Ben Bacarisse said:
<snip>
>
readstring is a pointer despite the []. C can't pass arrays and
rather than forbid this syntax it was taken to mean the same as char
*readstring in the context.
No, that wasn't the reason, as a matter of fact. In the early days of C,
pointers were described using [] rather than *. It wasn't long before the
* was introduced, at which point [] was used exclusively for arrays,
*except* in this situation - i.e. a function receiving a pointer as a
parameter. Just why it was retained, I don't know - possibly a nod in the
direction of backwards compatibility.
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Cromulent <cromulent@just extrememetal.co mwrites:
>
>
>>
>int tokeniseInput(c har readstring[])
>int tokeniseInput(c har readstring[])
readstring is a pointer despite the []. C can't pass arrays and
rather than forbid this syntax it was taken to mean the same as char
*readstring in the context.
pointers were described using [] rather than *. It wasn't long before the
* was introduced, at which point [] was used exclusively for arrays,
*except* in this situation - i.e. a function receiving a pointer as a
parameter. Just why it was retained, I don't know - possibly a nod in the
direction of backwards compatibility.
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Comment