Thursday, 27 March 2014

How to write a C program without a main function?.Is it possible to do that.Yes there can be a C program without a main function.Here’s the code of the program without a main function…


#include

#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 “);
}

Does the above program run without the main function? Yes, the above program runs perfectly fine even without a main function.But how,whats the logic behind it? How can we have a C program working without main ?

Here we are using preprocessor directive #define with arguments to give an impression that the program runs without main.But in reality it runs with a hidden main function.
The ‘##‘ operator is called the token pasting or token merging operator.That is we can merge two or more characters with it.

NOTE: A Preprocessor is program which processess the source code before compilation.

Look at the 2nd line of program-

#define decode(s,t,u,m,p,e,d) m##s##u##t

What is the preprocessor doing here.The macro decode(s,t,u,m,p,e,d) is being expanded as “msut” (The ## operator merges m,s,u & t into msut).The logic is when you pass (s,t,u,m,p,e,d) as argument it merges the 4th,1st,3rd & the 2nd characters(tokens).

Now look at the third line of the program-

#define begin decode(a,n,i,m,a,t,e)

Here the preprocessor replaces the macro “begin” with the expansion decode(a,n,i,m,a,t,e).According to the macro definition in the previous line the argument must de expanded so that the 4th,1st,3rd & the 2nd characters must be merged.In the argument (a,n,i,m,a,t,e) 4th,1st,3rd & the 2nd characters are ‘m’,'a’,'i’ & ‘n’.


So the third line “int begin” is replaced by “int main” by the preprocessor before the program is passed on for the compiler.That’s it…

The bottom line is there can never exist a C program without a main function.Here we are just playing a gimmick that makes us beleive the program runs without main function, but actually there exista a hidden main function in the program.Here we are using the proprocessor directive to intelligently replace the word begin” by “main” .In simple words int begin=int main.

Wednesday, 5 March 2014


How to download torrents without utorrent


       whenever we go to download Torrents we need to use uTorrent or BitTorrent or any other BitTorrent client. BitTorrent clients are used to download .torrent files and has been mostly used over the globe, BitTorrent is a P-2-P(Peer 2 Peer) sharing software working on BitTorrent Protocol written by Bram Cohen.

To download torrents without any BitTorrent client we are going to use web based Torrent client that let you download the torrents without the utorrent or any other client.
BitLet is a Java based web Torrent client which lets you download torrents directly using your browser. That means you do not need any BitTorrent client and still can download your favorite movies and games. BitLet allows you directly add the URL of the Torrent file to download or you can directly upload an .torrent file from your computer.
How to download torrents without utorrent
Screenshot of bitLet.org
For downloading using bitlet you need Java to run the client.
How to download torrents without utorrent
Here’s a picture of me downloading the Movie Saving Private Rayn. this BitTorrent client has no drawback instead the client lets you download with full speed you have and i guess its best for someone who needs to download torrents in their college or schools, then you won’t need any BitTorrent client to download. if you need to download any torrent the you can checkout The Pirate Bay
Hope you enjoy Bitlet.org and enjoy downloading some cool stuff, don’t forget to share it with your friends because sharing is caring