Friday, 6 July 2012

First c program "hello world"

I am going write the first c program but before you need a c compiler(software).there are a lot of compilers(software). like  Code::Blocks ,dev c++  Download dev c++ its free and install in your computer.open  dev c++ go to file-->new-->source file.
 start your first c program (do not type step1,step2..)

step1 #include<stdio.h>
step2 #include<conio.h>
step3 main()
step4 {
step5   printf("hello world");
step6   getch();
step7   }


After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.
output

The output of this program is hello world


How?
STEP1:
In almost every c program we use #include<stdio.h>.it is used to input the file stdio.h into the program we write.
STEP2:&STEP6:
if u write a program with out #include<conio.h> and getch() after running the program will close with out waiting your click.try it(remove step1 and step2) 
STEP3:&STEP4:&STEP7
main() it tell the computer this is the main part of this program inside "{"and"}"
STEP5
printf is used to print anything on screen.eg printf("hi"); it will print hi or printf("hello"); it will print hello

 IS IT HELPFIL? comment.







No comments:

Post a Comment