3 votes 3 votes #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"); } Programming in C programming programming-in-c + – Manali Sikdar asked Sep 7, 2014 Manali Sikdar 620 views answer comment Share Follow See 1 comment See all 1 1 comment reply Chandan Kumar 5 commented Oct 18, 2018 reply Follow Share If s,t,a,m,p,e,d is decoded to m s u t then how a,n,i,m,a,t,e is decoded to m a i n. I think there is some typo error. 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes 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" gatecse answered Sep 7, 2014 gatecse comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes same question https://www.hackerearth.com/practice/notes/writing-a-c-program-without-a-main/ Gurdeep Saini answered Mar 15, 2019 Gurdeep Saini comment Share Follow See all 0 reply Please log in or register to add a comment.