Wednesday, 8 January 2014

C Programming Language Tutorial

C Language
Let us first elaborate some basic things. As you know that computer has divided into two parts namely Hardware and Software.
Hardware are physically appears parts. Examples are – Keyboard, Mouse, HD, RAM, CD-ROM etc.
Software further classified into following types:
  1. Operating System
Operating system is a inbuilt set of various types of software that are very useful and essential for the proper working of computer system.
Examples: DOS, WINDOW7, WINDOW8, MAC, Linux etc.

  1. Application Software
Application software is a set of inbuilt tools and commands useful for different types of applications. MS-Office, AutoCAD, Tally some are mostly used examples of software.

  1. Programming
Programming is a different approach of software because here you do not have inbuilt set of tools and commands rather you have a way to create and developed programs by using style and structure of programming language you selected for development.

Examples: C, C++, Java, .NET, PHP etc.
Let take a look at diagram of Evolution of Software:




    • Binary language
    It represents binary i.e. 0 and 1. Since computer can understand only 0 and 1.

    • Machine language
    It typically refers to a set of instructions which can be directly used by computer without intermediate process.

    • Assembly language
    In this language symbolic assembly code were used. These are highly dependent on hardware of machine and thus lacked portability.

    • Procedural Oriented Programming
    It is a structural language and known as basic programming language.

    • Object Oriented Programming
    It is a top most layer. Class and Object as well as various types of techniques are including in this type of programming language.
    For a new beginner of programming let us discuss in detail some basic   concepts
What is language?
Code or set of instructions written in such a manner that computer potentially understand.
Types of language:
  • Low Level Languages
When the sequence of instructions is in the form of a set of code then it is depends on machine. The operation codes will be different from one machine model to another, so it is necessary that programs need to be rewritten.

  • High Level Languages
These languages are not coded but they resemble ordinary English statements. The memory address is referred by symbolic names. It translates the program into machine language so it is made understand by computer system. The resulting program is known as object file and the original program is known as source file.
What is Programming?
Set of instructions written in logical flow.
Logic - Sequence of instructions.
Let us take example of sum of two numbers. What is logic or we call it as what is a sequence?-
1.     Input two numbers
2.     Perform process of sum
3.     Print sum as output
 i.e. How to perform given program within a sequence known as logic.
History of C
It is developed in the early 1970s by Ken Thomson and Dennis Ritchie. It was named ‘C’ because many of its features were derived form earlier BCPL (basic code for programming language) language which is known as ‘B’ language. It is core and powerful programming language.
C Language’s Features
  • A simple core language with multiple functionality such as Math’s, Console library functions,
  • Focus on procedural programming.
  • It is use for system development work.
  • It is also use for developing application program as well as hardware control programs.
  • It provides variety of data types for structured program so it is powerful.
  • C compilers available for almost all types of PC’s.
  • The UNIX operating system was developed using C.
  • C is DOS based programming language.
  • Programs written under C are fast & efficient to execute.
Operators
An operator specifies an operation to be performed. An operator takes one or more operands, performs specified action on them, and returns desired result.
Operators
Symbols
Arithmetic
+, -, *, /, %
Relational
>, <, >=, <=, !=, ==
Logical
&&, ||, !
Assignment
=, +=, -=, *=, /=,%=
Increment
++
Decrement
--
Bit wise
&, |, ^, <<, >>, ~
Conditional
?, :

No comments:

Post a Comment