C hello world program :- code to print hello world. This program prints hello world, printf function is used to display text on screen, '\n' places cursor on the beginning of next line. This may be your first c code while learning programming.
C programming code
#include<stdio.h>
int main()
{
printf("Hello world\n");
return 0;
}
Compiling and running the above code.
Compiling and running c programs in gcc compiler
1. Save the code in a file say hello.c
2. To compile open terminal type gcc hello.c
3. To execute type ./a.out
2. To compile open terminal type gcc hello.c
3. To execute type ./a.out
You can also specify the output file name as follows:
gcc hello.c -o hello.out
hello.out is name of output file.
gcc hello.c -o hello.out
hello.out is name of output file.
Thanks for your feed back we will soon reply you EmoticonEmoticon