1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Introduction to C Programming

Discussion in 'C' started by lionaneesh, Jun 8, 2011.

  1. What is C ?


    C Programming Language was developed at AT & T’s Bell Labs in 1972. It was designed and developed by Denis Ritchie. Spite of C being an old language it still has remained one of the worlds most popular and one of the best programming language even came into existence!

    C is basically called a Middle Level language, since it was developed to have good programming efficiency as well as good machine efficiency! Most of the people today prefer to make their applications in higher level languages like Python, Perl, etc! But these languages itself are somewhat related to C in one way or the other! Eg : Languages like Python , PHP are made in C!

    People often ask me so as why they should care to learn C and understand it! The answer to this question is C is a language with a powerful code base and some strict rules! It provides a programmer the right niche to get kick started into programming with a strong background!

    Getting Started?


    To get started in C we have to get :-
    1. A Compiler
    2. A Text Editor (notepad or Vim will work)
    A compiler is a program which goes through our code, Checks for errors and converts it in a Lower Level Language that the Computer can understand (opcodes). There are many Free compilers out there and you can choose any of them! Just make sure your compiler should support ANSI C standard functions!

    I don’t want to directly just jump into coding but lets just see a glimpse of a basic C Code!

    Code:
    #include<stdio.h>
    
    Int main()
    {
       return(0);
    }
    Let’s walk through the code now:-
    1. “#include” is a preprocessor directive it stands for inclusion of a file before compilation!
    2. “Int main()” This tells the compiler that there is a function called main . Main is the function that is include in almost every useful C program! Int is the data type of the value it will return! (Note : This may seem confusing at first site but all things will be cleared as we move forward)
    3. { } The curly braces signal the start and the end of a function or a block!
    4. “return(0);” returns the value to the Operating System , Mostly 0 signals successful execution and rest numbers have their own error codes!
    That’s all for this article, Stay tuned for more!!
     
  2. lionaneesh

    lionaneesh Active Member

    Joined:
    Mar 21, 2010
    Messages:
    848
    Likes Received:
    224
    Trophy Points:
    43
    Occupation:
    Student
    Location:
    India
    Hey Guyz! This is my first tutorial on this site! Please let me know whether you like it or not!
     
  3. crome

    crome New Member

    Joined:
    Jun 6, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    yep i like it....
     
  4. lionaneesh

    lionaneesh Active Member

    Joined:
    Mar 21, 2010
    Messages:
    848
    Likes Received:
    224
    Trophy Points:
    43
    Occupation:
    Student
    Location:
    India
    Oh! Great! Thanks for reading my tutorial , Please read others too and let me know how you feel! :D
     
  5. jam143

    jam143 New Member

    Joined:
    Jul 1, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    n/a
    Location:
    philippines
    ohh.. thank you so much.. I now know at least the basic.. :D
     
  6. lionaneesh

    lionaneesh Active Member

    Joined:
    Mar 21, 2010
    Messages:
    848
    Likes Received:
    224
    Trophy Points:
    43
    Occupation:
    Student
    Location:
    India
    My Pleasure
     
  7. susmithareddy

    susmithareddy New Member

    Joined:
    Jan 4, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    thank you so much .. it is really useful to me
     
  8. sunnybaba27

    sunnybaba27 New Member

    Joined:
    Feb 6, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I want to know about C programming
    Should I purchase Turbo C or Borland C
    I want to write embedded programming.
     
  9. engr.fawad

    engr.fawad New Member

    Joined:
    May 30, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Thanks for this info.

    The following table shows a list of variable types and ranges that each variable might hold.

    DECLARATION TYPE SIZE RANGE
    char Character 1 byte -128 to 128
    unsigned char Unsigned character 1 byte 0 to 255
    int Integer 2 bytes -32768 to 32767
    unsigned into Unsigned integer 2 bytes 0 to 65,535 '
    signed int Signed integer(same as 2 bytes -32768 to 32767
    short int Short integer 2 bytes -32768 to 32767
    unsigned short int Unsigned short integer 2 bytes £ to 65,535
    signed short int Signed short integer 2 bytes -327.68 to 32767
    long int Long integer 4 bytes -2,141,483,648 to 2,147,483,647
    signed long int Signed log4nteger 4 bytes -2,147,483,648 to 2,147,483,647
    unsigned long int Unsigned long integer 4 bytes 0 to 4294967295
    float Floating point T4 bytes -3.4E+38 to 3.4E+38
    double Double floating point 8 bytes -1.7E+308 to 1.7E+308
    long double Long double floating 8 bytes -1.7E+308 to 1.7E+308

    Source business-science-articles.com/notes-lectures/bachelor-of-computer-science/programming-fundamentals/261-variables
     
  10. ovicel

    ovicel New Member

    Joined:
    Sep 28, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Thanks! I LIKE IT'S
    Waits another more....
    Keep Share...
     

Share This Page