#include <stdio.h>
#define foo(x, y) #x #y
int main()
{
printf("%s\n", foo(k, l));
return 0;
}
Output:kl
I know that ## does concatenation. From the output it seems that #
also does concatenation.
Am I correct?
If I am correct then what is the difference between ##
operator and #
operator?
#
stringifies the parameter. See http://www.cs.utah.edu/dept/old/texinfo/cpp/cpp.html#SEC15
##
concatenates strings. See http://www.cs.utah.edu/dept/old/texinfo/cpp/cpp.html#SEC16
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