Reputation: 1
When I try to run this program, my terminal doesn't display anything.
Here is the program:
/* Print a message on the screen*/
#include <stdio.h>
int main()
{
printf("Hello World.\n");
return 0;
}
Am I doing anything wrong?
--EDIT--
My antivirus was blocking the execution of the program.
Upvotes: 0
Views: 3039
Reputation: 15584
Add a newline to the end of your string (or use puts
):
/* Print out a message on the screen*/
#include <stdio.h>
main()
{
printf("Hello World.\n");
return 0;
}
Usually compilers will optimize this printf
call to puts("Hello, World.")
.
It is also recommended to declare main
as an int
(use int main() ...
).
Upvotes: 1
Reputation: 497
When you define a function in C you need to specify the return type.
So your main function has to be declared as int main()
(because it returns an integer)
Upvotes: 0