- Create a text file helloworld.c with nano, Ctrl-X to Exit and save the file.
$ nano helloworld.c
- Enter the code:
#include <stdio.h>
int main() {
printf("Hello World\n");
return 0;
}
- Compile the code and set output as helloworld
$ gcc -o helloworld helloworld.c
- Run the generated helloworld
$ ./helloworld
The words "Hello World" will be printed.
No comments:
Post a Comment