The #
symbol is used at the start of preprocessor directives (#ifdef
, #define
etc). #
is also used as the stringification operator.
##
is the token pasting operator.
Then in an online quiz I saw this:
#define MAKECHAR(operand) #@operand
What operator is #@
and what is it used for?
Use a semicolon to join two related independent clauses in place of a comma and a coordinating conjunction (and, but, or, nor, for, so, yet). Make sure when you use the semicolon that the connection between the two independent clauses is clear without the coordinating conjunction.
We use of when we want to show that people or things relate to other things or people. For example, when we want to say that something or someone belongs to or is a part of something or someone else, we can do it like this: Tiffany stared at the floor of her room.
Semicolons should introduce evidence or a reason for the preceding statement; for example, this sentence appropriately uses a semicolon. A colon, on the other hand, should be used for a stronger, more direct relationship. It should provide emphasis, an example, or an explanation.
idiom. used to say that it would not be useful to do something. "You should talk to her." "What's the use? She's not going to change her mind."
It is an analogy to the stringify marker #
but for characters, but it is not standardized. For example, clang/llvm does not support it.
To show the analogy:
#define MESSAGE(x) printf("%s: %d\n", #x, x)
int main(){
int i = 5;
MESSAGE(i); // expands to printf("%s: %d\n", "i", x)
return 0;
}
Output is:
i: 5
With a compiler supporting #@
, you could write:
#define MESSAGE(x) printf("%c: %d\n", #@x, x)
int main(){
int i = 5;
MESSAGE(i); // expands to printf("%c: %d\n", 'i', x)
return 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With