I wrote a program to write infinite files and hence eat up all the memory of your computer.Does it work?The program doesnt end and my antivirus doesn't do anything to close it.
Viruses replicate themselves. Your program has undefined behaviour because it uses the uninitialized variable n. In theory this means that the program could act as a virus but that is unlikely. What you have here is probably a program that (over)writes "hello" to five files an unknown (possibly infinite) number of times.
the first arg to argc in main is the program name, probably with its full path. You can use that to make a copy of the current executable to another name in another place if your OS will allow you to copy a program that is currently running (it may or may not).