Jump To Content

LearnHub




C programming

C programming is easy and at the same time difficult too. Therefore, it is advised to pay attention at each and every line that follows.
STARTING WITH C
There are two ways of starting with C :-

* Open MS-DOS prompt.
* Type TC and press ENTER.
* Now you have entered the huge world of C programming.

The next altenative is :

* Open the folder which contains C files.
* Double-click on the TC icon.

Basic terminology


Constants - Constants are those individual units whose value does not change during program execution. In other words, their value remains constant.For ex.- number 5

Variables - Variables are those units whose value can change during program execution. For ex.- initially we say that a = 5 and b = 0. then we say that b = a + 2 . Now b's value will be 7.

Operators - Operators are those directions which are used by the programmer to alter the variables' value. In the above example '+' is an operator which is used to change b's value.However, there are more operators which are used for some other processes as well.

Functions - Functions can be defined as a group of statements which make use of variables, operators, etc. for completing a particular task. For example, printf is a function used in C to show output on the monitor.

A Simple Program
This program is used to display "this is easy !!!" on the monitor. Before beginning with the program, please note that every program contains a main function.


#include<stdio.h>
#include<conio.h>
void main()
{
printf("This is easy !!!");
getch();
}



The first two lines of the program tell the compiler to 'include' the header files. Header files are those files which are provided in C for user assistance. They contain some pre-defined functions. The 'main' is succeded by a bracket which tells the compiler that main is a function. Then the { brace tells it that the definition of the function begins. Since printf is also a function (although pre-defined) it is also succedded by a bracket. The bracket contains the sentence which is to be displayed. Please note " sign before and after the sentence. It tells the compiler where the sentence begins and where it ends. The semi-colon ; after the printf statement is necessary since it shows that the command is finished. Getch() is another function which implies that a key is to be pressed by the user at the time of execution. Lastly, the } brace tells that the main function has ended now.
Hence the program displays the sentence "this is easy !!!" and terminates as soon as the user presses a key.


  1. ShyamSaraf saidTue, 05 Aug 2008 05:05:44 -0000 ( Link )

    This lesson is really good for beginners. I think it provides a perfect start-up for learning the C language

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  2. RobotGrrl saidWed, 06 Aug 2008 13:26:12 -0000 ( Link )

    Simple tutorial- good for newbies at programming or C :) Why is there a phone number there? Lol… wouldn’t you get a lot of calls if you post it on the internet?

    Actions
    Vote
    Current Rating
    -1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  3. preet_ud saidMon, 08 Sep 2008 14:45:24 -0000 ( Link )

    very gud…. its very gud method of teaching.. thx…

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  4. preet_ud saidMon, 08 Sep 2008 14:47:53 -0000 ( Link )

    how to go to next lesson???plz tell….

    Actions
    Vote
    Current Rating
    -1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  5. shubhi saidTue, 09 Sep 2008 13:11:54 -0000 ( Link )

    Really sorry!! I have not posted any other lesson till now! But if you say, I can add a new one!

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  6. dcooldivya saidMon, 27 Oct 2008 15:10:57 -0000 ( Link )

    thanks mam….really a nice one…m just a beginner…n ur lesson is really helpful

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  7. dcooldivya saidMon, 27 Oct 2008 15:11:32 -0000 ( Link )

    mmmm plzzz keep on posting more lessons…

    Actions
    Vote
    Current Rating
    -1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  8. kir360 saidThu, 20 Nov 2008 13:36:15 -0000 ( Link )

    nice start…

    When I had begun with C two years ago, I just thought I was impossible to self-study it. But this one seems to be very cool. Very simple start, I love it!
    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  9. ArindamM saidSun, 14 Dec 2008 07:34:24 -0000 ( Link )

    when is the next lesson succeeding the above would come. I am eagerly awaiting the same. Its like taking virtual private tutors class.

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    2 Total Votes

    Post Comments

  10. shubhi saidWed, 24 Dec 2008 07:24:00 -0000 ( Link )

    Thanx to all of you. Just a bit busy now-a-days. I will try to post the next lesson in January!!! Thanx again.

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  11. granget saidThu, 24 Sep 2009 16:33:54 -0000 ( Link )

    thank u very much shubhi.i am also a beginner.i am also eagerly waiting for the next lesson.(i am in my b-tech 1st year)

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    2 Total Votes

    Post Comments

Your Comment
Textile is Enabled (View Reference)