The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+3 votes
144 views
#include<stdio.h>
#define decode(s,t,a,m,p,e,d)m##s##u##t
#define begin decode(a,n,i,m,a,t,e)
int begin()
{
    printf("hello");
}

 

asked in Programming by Active (2.7k points) | 144 views

1 Answer

+1 vote
There is no error. ## does string concatenation in a macro. So, macro will expand as follows:

begin -> decode(a,n,i,m,a,t,e) -> m##a##i##n -> main

So, the function name becomes main and program prints "hello"
answered by Boss (17.8k points)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

34,774 questions
41,739 answers
118,908 comments
41,386 users