Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to computers

3,169 views

Published on

This slides present a knowledge of computer, memory, programming languages etc. That is required before learning C programming language.

http://www.learnbywatch.com

Published in: Education
  • Be the first to comment

Introduction to computers

  1. 1. C Programming Language By: Yogendra Pal yogendra@learnbywatch.com Dedicated to My mother and Father
  2. 2. t y Keep your notebook with you. Write important point and questions that comes in your mind Solve Mind band exercise. C Rewind when not clear Ask Questions by call or SMS or by mail Keep Watching Keep Learning THIS IS INTRODUCTION 2
  3. 3. Computer • Electronic Device • Store, Manipulate and Transmit data. • Data can be – Numeric – Character (Name, Address etc.) – Graphics data (Charts, Photographs, Videos) – Sound (Music, Speech etc.) 3
  4. 4. Computer… • Two very important for a programmer – Numeric – Character • Scientific and Engineering Applications – Numeric • Business applications – Numeric and Character 4
  5. 5. Memory • Every information is stored in binary code. • Binary code is the sequence of 0s and 1s. • 0 and 1 are called bits. • 0 represents OFF and 1 represents ON. • 8 bits makes 1 byte. 7 6 5 4 3 2 1 0 • Character takes one byte to store. 5
  6. 6. Memory… • Bit is the smallest unit of information storage. • Bit consists a single binary digit (0 or 1). • We can interpreted 0 and 1 as: – 0 : False : Off – 1 : True : On 6
  7. 7. Memory… • 1 bit consists 0 or 1. • 8 bits makes a byte. • 210 (1024) byte make a Kilobyte or KB. • 210 (1024) Kilobyte make a Megabyte or MB. • 210 (1024) Megabyte make a Gigabyte or GB. • 210 (1024) Gigabyte make a Terabyte or TB. Bit < Byte < KB < MB < GB < TB 7
  8. 8. Machine needs instructions I o ć 8
  9. 9. Programming Language • Machine Language • Assembly Language • High-Level Language 9
  10. 10. Machine Language • Strings of numbers giving machine specific instructions. • Also known as Machine code. Example: +1300042774 +1400593419 +1200274027 10
  11. 11. Machine Language… • Very Few programs are written in machine language because:- – It is very difficult to work with machine language. – Program written for one type of computer will not run on other type of computer (Each type of computer has it’s own instruction set). 11
  12. 12. Assembly Language • English-like abbreviations representing elementary computer operations. • Simpler than machine language. Example: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY • Translate in machine code before execute. • Translation is done by assembler. 12
  13. 13. High-level Languages • Codes similar to everyday English (Easy to understand). • Use mathematical notations. • Example – grossPay = basePay + overTimePay • Translate in machine code before execute. • Translation is done by compiler or interpreter. 13
  14. 14. High level languages… • The program written in high level language is known as source code or source program. • The compiled source code results in machine- language. • Machine language code is also known as object code or object program. 14
  15. 15. Compiler vs. Interpreter • Interpreter reads the source code one line at a time convert it into machine code. • Compiler reads the entire program and converts it into machine code. • machine code is a code that the computer can run directly. • machine code also known as object code or binary code. 15
  16. 16. Program • Using programming language we create instructions or set of instructions. • This set of instructions is also knows as computer program or software program or just program. • Example programs or softwares: – Word processing program – Computer Games or video games 16
  17. 17. History of C • Evolved by Dennis Ritchie in 1970 at Bell Telephone Laboratories from two previous programming languages, BCPL and B. • Used to develop UNIX. • Used to write modern operating systems. • Hardware independent (portable). • Standard created in 1989, updated in 1999. BCPL B C Martin Richards Ken Thompson Dennis Ritchie 17
  18. 18. C: A Middle Level Language • Best elements of high level language and control and flexibility of assembly language. • C allows the direct manipulation of bits, bytes and addresses. • C has several built in data types. • Permits type conversion. • No run time error checking. • Well suited for system-level programming. 18
  19. 19. The C Standard Library • C programs consist of pieces/modules called functions. – A programmer can create his own functions. • Advantage: the programmer knows exactly how it works • Disadvantage: time consuming – Programmers will often use the C library functions. • Use these as building blocks 19
  20. 20. C Standard Library… • Avoid re-inventing the wheel – If a premade function exists, generally best to use it rather than write your own – Library functions carefully written, efficient, and portable 20
  21. 21. Other High-level Languages • Other high-level languages – FORTRAN • Used for scientific and engineering applications – COBOL • Used to manipulate large amounts of data – Pascal • Intended for academic use 21
  22. 22. Structured Programming • Disciplined approach to writing programs. • Functions are the building blocks of programs. • Allow you to code separate tasks in a program, make your program modular. • Clear, easy to test and debug and easy to modify. • C is a structured programming language. 22
  23. 23. Library and Linking • Library : Collection of functions. • Linker : Combines the called function object code with the code you written. 23
  24. 24. Program Development • Edit : Program is created in the editor and stored on disk. • Preprocess: Preprocess program processes the code • Compile : Compiler creates object code and stores it on disk. • Link : Linker links the object code with the libraries. • Load : Loader loads program in memory. • Execute : CPU takes each insruction and executes it. 24
  25. 25. Form of C program • The main() function must present in program. • Keywords can not used as a variable name or a function name. • Case sensitive language. – else  ELSE  • It may have many functions. 25
  26. 26. Mind Bend • Write 4 different data types. • What is meant by a computer program? • Differentiate bit & byte? • What is a machine language? How it is different from High level language? • What are the advantages of high level language? Give some examples of high level language. 26
  27. 27. Mind Bend • Differentiate Compiler and Interpreter. • What is source program? • What is object program? • Who develop the C language and where? • Can we use uppercase in C program? • Computer is an __________ device. • Binary code is the sequence of _ & _. 27
  28. 28. To get complete benefit solve all the quiz on www.learnbywatch.com For any problem in this tutorial mail me at yogendra@learnbywatch.com with the subject “C” For Other information mail at info@learnbywatch.com Keep Watching Keep Learning NEXT IS C BASICS

×