Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are @ and $ characters not used for anything in C and C++? [closed]

In both languages the basic source character set includes every printable ASCII character except @, $ and `. I can understand not using grave accent because it's not always interpreted as a separate character and it also looks very similar to apostrophe. But is there a specific reason why @ and $ don't have any usage or did the language designers just run out of ideas? :)

like image 866
Timo Avatar asked Aug 23 '11 04:08

Timo


People also ask

Why does C not have a string type?

Both Java and Python have the concept of a "string", C does not have the concept of a "string". C has character arrays which can come in "read only" or manipulatable. A character array is a sequence of contiguous characters with a unique sentinel character at the end (normally a NULL terminator '\0' ).

What characters are allowed in C?

Only the underscore, the decimal digits, the unaccented upper- and lowercase letters, and universal character names are required to be allowed in C identifiers (the universal character names are new in C11).

What character does every string in C terminate with?

Strings are actually one-dimensional array of characters terminated by a null character '\0'. Thus a null-terminated string contains the characters that comprise the string followed by a null.

Which character always ends a statement?

Semicolon is a statement terminator which is purely used to identify the end of a statement.


1 Answers

I can't imagine what capacity they would fill. Perhaps using @ to signify pointers...

But $ and @ are very busy looking symbols, perhaps almost distracting, and if you throw them into the mix with an already diverse syntax, just because they're there, you might end up having a language that reads like a perl regex. Which is to say it doesn't read at all. :P

like image 197
Anne Quinn Avatar answered Oct 07 '22 02:10

Anne Quinn