Sunday 19 February 2012

First Program In C

Heyy Guyzz before coding please download this ide
from this link
Download

This is cfree 5.0 pro version

Kick start to C language .Most you will be making "hello world" as your first program ,i mean printing hello world on the console  screen. Even i also started with this as my first program. But not my blog readers because you are unique.We will be printing hello to your self  lol . Any ways the first program to print any thing on a console screen, it goes like this

Remember c is a case sensitive language .if you face any problems in coding then copy and paste the code , .But plzz practice the code .

Printing my name on console :-

#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
 printf("hii guyzz this is manoj bojja ");
 getch();
}


save this as name.c


seeing above code for the first time i also blanked out like you guyzz .

But after 1 hour i understood what this code is doing.

You all will be understanding in 20 mins because you guyzz are unique.

now on the first line i.e., #include<stdio.h>
# represents pre processing directory

stdio.h represents the header file which contains  some function
it is like a person from Delhi know Hindi language respectively all the word in hindi
and a person from Andhra Pradesh knows Telugu language respectively all the word in hindi


Similarly a  header file know all the library function define under this header file.

 conio.h is also a header  file which knows the meaning of getch() and clrscr() function



every c coding we do have a main in which we write the syntax .
main syntax is

mani()
{

}

for every opening Brussels their should be a closing  Brussels


now coming on to clrscr function it is a predefined function in c language under conio.h header file
the functionality of this function is to clear output screen.
getch() function also comes under conio.h it pause the out put screen
if u want to see the difference of pausing and not pausing the output screen then remove execute the program the program just blinks.

printf() is a library function which comes under stdio.h header file which prints the given output on the

screen. Syntax for printf is printf(" any matter you want to display ");

in every line in main we put a ; at the end of the line because it tells that the code is for that line only i.e., it terminates that function


Hope you all enjoyed coding .Please post comments if u have any doubts regarding this program.

Have a nice day.





No comments:

Post a Comment