I wrote this program:
#include <stdio.h>
main()
{
int n;
n=1;
while (n>0)
{
puts("Write a number: ");
scanf(" %d",&n);
printf("This is the number you wrote: %d\n", n);
}
}
Apparently there are absolutely no syntax errors, nor any compilation error. It compiled and built perfectly.
Now, if I switch this line:
puts("Write a number: ");
with this one:
printf("Write a number: ");
it compiles with no errors but when the compiled object launches, it immediately stops and an anti-virus warning pops up saying it identified a trojan horse. Before taking any conclusions, I built it several times and after getting the same message I scanned it in virustotal.com and this was the result.
Well I know puts
is actually more correct than printf
given the objective, but still it should work just fine.
What's wrong here?
I'm using AVG anti-virus, and Pelles C to compile.