COME ON CODE ON

A blog about programming and more programming.

Program without main() ?

with one comment

See this code first :

#include"stdio.h"
#define decode(s,t,u,m,p,e,d) m##s##u##t
#define begin decode(a,n,i,m,a,t,e)

int begin()
{
    printf(" hello ");
}

Compile and run this. It works fine but how?Actually its a very good example of the preprocessor directive #define and token pasting or token merging operator ‘##’. Kool program isn’t it?

-fR0D

Advertisements

Written by fR0DDY

February 18, 2009 at 12:54 PM

Posted in Beautiful Codes

Tagged with ,

One Response

Subscribe to comments with RSS.

  1. yaa basically on expanding macros it will be nothing but:

    int main()
    {
    printf(” hello “);
    }

    BTW: nice trick

    Akash

    May 19, 2009 at 1:07 PM


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: