In this tutorial we’ll be making our first running C Program, It will simply print out a Message on the Screen! So let the coding begin. :party: hello.c Code: #include<stdio.h> int main() { printf("Hello World! This is my first C Program "); return(0); } Note: I am using GCC compiler on a UNIX to compile my C programs, for different compilers please see your Compiler manual! Compiling:- Code: gcc hello.c –o hello Explanation:- The first of the program simply includes the header file stdio.h (Standard IO) this file is necessary as it contains Constants, definitions etc, for the common functions like printf() etc . That’s why you’ll find it in almost every C program. The second line “int main()” , this tells the compiler to declare a main() function and it will return an int [int = Integer] after its execution. In the third line we declare a printf statement, printf stands for print format string , This functions simply prints a format string to the screen , in this case it prints “Hello World! This is my first C Program” on the screen. The fourth line includes a return statement this simply returns a status code. This status code simply means if the program was successfully executed or a error was occurred. Now let’s compile our program and see the output. To run the program simple ‘cd’ to the path where the program is situated and enters its name at the command prompt. Output:- Code: Hello World! This is my first C Program Voila, Congratulations we just executed our first program! That’s all for this article, Stay tuned for more.
I am using GCC on Unix which is mostly available on almost all Unix Machines For further Info Check :- http://gcc.gnu.org/
yeah I remember this program at first day of my c class where I was suppose to create program which prints this "hellow word" 10 times with help of for loop.