/* use of token pasting operator with Output */
//Token pasting operator is used to concatenate two tokens into a single token.
#include
#define PASTE(a,b) a##b
#define MARKS(sub) marks_##sub
int main()
{
int k1=15,k2=60;
int marks_os= 95, marks_ds=99;
//converting statement below to printf("%d %d",k1,k2)
printf("%d %d ",PASTE(k,1),PASTE(k,2));
//converting statement below to printf("%d %d",marks_os,marks_ds)
printf("%d %d ",MARKS(os),MARKS(ds));}
//Token pasting operator is used to concatenate two tokens into a single token.
#include
#define PASTE(a,b) a##b
#define MARKS(sub) marks_##sub
int main()
{
int k1=15,k2=60;
int marks_os= 95, marks_ds=99;
//converting statement below to printf("%d %d",k1,k2)
printf("%d %d ",PASTE(k,1),PASTE(k,2));
//converting statement below to printf("%d %d",marks_os,marks_ds)
printf("%d %d ",MARKS(os),MARKS(ds));}
0 comments: