Operations And Operands In C

Opreasions and operands



OPERATORS:   

                                      For example in this expression 4 + 5 = 9 . Here 4 and 5  are called operands and + is called operators . C language supports different operators which are given below.

1:   Arithmetic Operators. 
2:   Rational Operators.
3:   Logical Operators.


Arithmetic Operators: 

                                  These type of operators are used to perform mathemetical operations.Like addition ,multiplication,division etc.





Operators in c


  1.  Practice :
          #include <stdio.h>
         #include <conio.h>

                        int main()
{

                     int a = 10 , b = 15 ;
              printf (" Addition Of Two numbers Is",a+b);
             getch();
 }


2:  Practice :

  #include <stdio.h>
         #include <conio.h>

                        int main()
{         
                   int a = 10 , b = 15 ;
       printf (" Addition ",a+b);
       printf(" Subtraction", a-b);
       printf(" Multiplication ", a*b);
       printf(" Division ", a/b);
               getch();
                                                  }




Generation Of Computers






Generation of computers



First Generation Computers:

a glass tube surrounding a vacuum an area from which all gases have been removed). What makes it interesting is that when electrical contacts are put on the ends, you can get a current to flow though that vacuum. Thomas Edison noticed this first in 1883 .First generation computers relied on machine language to perform operations, and they could only solve one problem at a time. Input was based on punched
cards and paper tape, and output was displayed on printouts. UNIVAC and ENIAC computers are examples of first-generation computing devices. The UNIVAC was the first commercial computer delivered to a business client, the U.S. Census Bureau in 1951.



Second Generation Computers:

The transistor was far superior to the vacuum tube, allowing computers to become smaller, faster, cheaper, more energy-efficient and more reliable than their first-generation predecessors. Though the transistor still generated a great deal of heat that subjected the computer to damage, it was a vast improvement over the vacuum tube. Second-generation computers still relied on punched cards for input and printouts
for output. Second-generation computers moved from cryptic binary machine language to symbolic, or assembly, languages, which allowed programmers to specify instructions in words. High-level programming languages were also being developed at this time, such as early versions of COBOL and FORTRAN. These were also the first computers that stored their instructions in their memory, which moved from a magnetic drum to magnetic core technology. The first computers of this generation were developed for the atomic energy industry.


Third Generation Computers:

Transistors were miniaturized and placed on silicon chips, called semiconductors, which drastically increased the speed and efficiency of computers .Instead of punched cards and printouts, users interacted with third generation computers through keyboards and monitors and interfaced with an operating system, which allowed the device to run many different applications at one time with a central program that monitored the memory. Computers for the first time became accessible to a mass audience because they were smaller and cheaper than their predecessors .


Fourth Generation Computers:

Microprocessor brought the fourth generation of computers, as thousands of integrated circuits were built onto a single silicon chip.In 1981 IBM introduced its first computer for the home user, and in 1984 Apple
introduced the Macintosh. Microprocessors also moved out of the realm of desktop computers and into many areas of life as more and more everyday products began to use microprocessors. As these small computers became more powerful, they could be linked together to form networks, which eventually led to the development of the Internet. Fourth generation computers also saw the development of GUIs, the mouse and handheld devices.


Fifth Generation Computers:

fifth generation computing devices, based on artificial intelligence, are still in development, though there are some applications, such as voice recognition, that are being used today. The use of parallel processing and superconductors is helping to make artificial intelligence a reality. The goal of fifth-generation computing is to develop devices that respond to natural language input and are capable of learning and self-organization.






Basic Structure Of C Program:




C Basic Streucture







Basic Structure Of C Program:

#include<stdio.h>               ( Standard input output )
#include<conio.h>              ( Console input output )
                                  main ()
      Starting point        {            Body of a program       }       ending point

Example:
#include<stdio.h>
#include<conio.h>
          Int main()
{                  printf  (“ Arguments” )   ;             }

Space Sequences: 

Space sequences are used to control the cursor position.


\n           is used for New line.
\t            is used for tabs    ( 1 tab is equal to 3 spaces ).


Practice No # 1 :
                                  C
                                  Programming
                                  Practice
                                  Number
                                  One
If this is our required output then we code it in C like ,
#include <stdio.h>
#include <conio.h>
             Int main ()
{       printf (“C \n Programming\nPractice\nNumber\nOne”); }
We Can also Write it as :
#include <stdio.h>
#include <conio.h>
             Int main ()
{       printf (“ C\n”);
        printf (“
 Programming\n”);
        printf (“
Practice\n”);
        printf (“ 
Number\n”);
        printf (“
One\n”);        }


Format Specifiers And Data Types In C language

Data TYpes and format specifiers of c




In C language there are 4 format specifiers which specify the data,that the given input belongs to which type of data.The Four types of Format specifiers are given below.

Format Specifies:

Numeric               %d        ( 0 to 9 )     
Decimal                %f        ( 9.8 ,7.6 )
Character             %c       (  ‘b’  , ‘a’ )
Characters              %s     (“ Coder”, “Karachi”)

Data Types:

                     
There are three types of data in C.
Int  ( integer ):

                           The type of data which is designed for the work with the integer values.
e.g    { int x = 5 ; }
Float  ( Decimal ) :

                             
      This type of data contains values such as 8.98 , 9.76.
       e.g          { float x = 9.87 ; }
Double : 

                 
This type of data is used to define big floating numbers.
e.g  { double x = 899766666.78 ; }

Char   ( Character ):

                 
The type of data which is used to define the character.single character must be written in single code like ‘b’,’a’.
e.g {  char x = ‘a’ ; }



Variables:

                 
Variable is nothing its just a name which is given to the storage area that our program can manipulate.Each variable in C has a specific type for size and layout of variables memory.
Rules Of Naming The Variables:

1.    First word must be a lower cap alphabates.
2.    Space can not be valid.
3.    Only accepts special character underscore _ .

Identifiers:

                   
Identifiers are created to give unique names to object in a program. An identifier is a sequence of letters, digits, and the special character _. A letter must b a first character of an identifier.


Constants:

                  
Constants are the terms which can not be changed during the execution of a program.

Translators And Debuging Proccess:

                               


C Language Translators and debuging process



Translators:


      A computer can only understand programs defined using machine code. Consequently a program written for example in a high level language such as Java cannot be run directly. To execute a computer program written in high or low level language, it must be first be translated.

The conversion of source code into machine code is done by the translators. There are three types of translators which converts source code into machine code.

Compiler:
                        A Compiler is a program that translates a high level language into machine code.
The Turbo Pascal compiler, for example, translates a program written in Pascal into machine code that can be run on a PC.


Advantages Of Compiler:

1.      Fast in execution.
2.      The object/executable code produced by a compiler can be distributed or executed without having to have the compiler present.
3.      The object program can be used whenever required without the need to of recompilation.

Assembler:

                    An Assembler converts an assembly program into machine code.


Interpreter:
                     An Interpreter is also a program that translates high-level source code into executable code. However the difference between a compiler and an interpreter is that an interpreter translates one line at a time and then executes it: no object code is produced, and so the program has to be interpreted each time it is to be run. If the program performs a section code 1000 times, then the section is translated into machine code 1000 times since each line is interpreted and then executed.


Debugging Process:
                                                           The process of finding and fixing the bugs or defects in a computer program is called debugging. There are three types of errors which occurs commonly.


Syntax Error:

                       
This error occurs when a programmer write a code which is incorrect or against the rules of written programming language.

Logical Error: 

                        
A mistake in programs’s source code that results in incorrect or unexpected output. This can only be identify by the programmer.

Runtime Error: 

                          
This error occurs due to the lose of information, leakage or memory  and during the executation time when we not perform tasks well.

Introduction To Programming Language

Introduction of c language




Language:

                       They Way of Communication between two sources is called a language.And the way of communicate between user and computer is called programing language.

Types Of Programming Language:

Machine Language:

                            The language which is based on binary numbers or the language of 0s and 1s is called machine language.0 and 1 is the concept of electricity on and off. This language is directly understood and obeyed by the computer without any translator.
Assembly Language:

                                   Assembly language were developed in 1950 to reduce the complexity of programming. In this language abbreviation or mnemoric code were used for example, ADD
for addition. This language is also known as symbolic language. Assembly language do not replace machine language. However, it must be converted into machine code for an assembly language program to be executed.
High Level Languages:

                                               These languages were developed to make programming more easier, less error prone and to remove the details of the internal structure of a particular computer. These languages is much similar to the human languages. Fortran ii was one of the first language which was introduced in 1958. The computer does not understand these languages directly, they have to processed by passing them through compiler which translates them into machine code then it can be executed.

e.g Java, Pascal, Fortran ii