Does At symbol (@) and Dollar Sign ($) has any special meaning in C or C++

后端 未结 3 425
攒了一身酷
攒了一身酷 2020-12-08 19:51

Recently one of my friend encountered this question in an interview. The interviewer asked him if the special characters like $, @, |, ^, ~ have any usage in c

3条回答
  •  一向
    一向 (楼主)
    2020-12-08 20:23

    @ is generally invalid in C; it is not used for anything. It is used for various purposes by Objective-C, but that's a whole other kettle of fish.

    $ is invalid as well, but many implementations allow it to appear in identifiers, just like a letter. (In these implementations, for instance, you could name a variable or function $$$ if you liked.) Even there, though, it doesn't have any special meaning.

提交回复
热议问题