C Program which delete itself

Here I'm sharing a program which will destroy itself. When you will compile this code it will generate an exe file but it will delete itself upon execution. This is a self destructing C Program. Here is the source code.
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
printf(“This program will destroy itself if u press any key!!!\n”);
getch();
remove(_argv[0]);/*array of pointers to command line arguments*/
}



For better observation I'll suggest to execute this code from command line. If you're having troubles in Compiling the code then take a look How to Compile a C Program.
Previous
Next Post »