Monday, January 27, 2014

C programming - Your first program in C



Lesson 1

( Your first program in C )


Welcome back on learn 4 free programming!

 If you don have C you can download it from :
and install it.When you done that or you already have C we can start making first C program.

When you open your program it should write on the screen message that says "Hello World"      ( Picture 1), so follow my steps.


Picture 1
"Hello World"



  1. You have to save your program (example: "my first program.c")but remember to put .c on the end
  2. On the beginning of program you have to include header files(for this example we will include just one and that's stdio.h. Header files contain functions that we use in the program.
  3. Now you need to type in "int main()" that means the start of program and you have to open and close "block" with { }.
  4. In it you have to type "prnitf("Hello World!"); " printf function is used for printing text on the screen and in it you type text that you want to appear on screen. 



example:

#include <stdio.h>

int main(){

     printf("Hello World!");

     getch();
}

Okay that's it for today come back to learn more about C. I started this blog several days ago so i will be posting new lessons every day or two. See you next time :) .

See the History of C here:
http://learn-4-free-programming.blogspot.com/2014/01/programming-language-c-history-c-was.html

If something doesn't work you can email me on : sashans89@gmail.com and i will help you.

No comments:

Post a Comment