i was trying to paste c and 4 and expected output as c4 but can't follow the same , what is problem with my code
#include<stdio.h>
#define paste(a,b) (#a)##b
int main()
{
printf("\n%s",paste(c,4));
return 0;
}
i was trying to paste c and 4 and expected output as c4 but can't follow the same , what is problem with my code
#include<stdio.h>
#define paste(a,b) (#a)##b
int main()
{
printf("\n%s",paste(c,4));
return 0;
}
#include<stdio.h>
#define stringize(a) #a
#define paste(a,b) stringize(a##b)
int main()
{
printf("\n%s",paste(c,4));
return 0;
}
##
concatinates parameters but #
stringize a parameter and you cannot use them together like this: #define paste(a, b) #(a##b)
. That would give you an error
error: '#' is not followed by a macro parameter