csci 130 chapter 1. history of c bell telephone laboratories (1972) dennis ritchie (also created...
TRANSCRIPT
![Page 1: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/1.jpg)
CSCI 130
Chapter 1
![Page 2: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/2.jpg)
History of C
• Bell Telephone Laboratories (1972)
• Dennis Ritchie (also created UNIX)
• A - B - C
![Page 3: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/3.jpg)
Initially Many Versions
• Incompatibility
• ANSI– American National Standards Institute
• ANSI Standard C
![Page 4: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/4.jpg)
Advantages of C
• Powerful, Flexible– Operating Systems– Applications software– Compilers
• Popular
• Portable
• Modular (should be written in functions)
![Page 5: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/5.jpg)
Problem Solving Technique
• Define Problem
• Devise plan to fix problem
• Implement the plan
• Test
![Page 6: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/6.jpg)
Necessary Information
• Is computer program required?
• Inputs/Outputs
• Formulas
• Organization (flow of logic)
![Page 7: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/7.jpg)
Ex: Find area of a circle
• Is computer required?
• Inputs / Outputs– Need the radius of circle as input– Area will be the output
• Formulas– Area = pi * radius ^ 2
![Page 8: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/8.jpg)
Find area of circle - continued
• Flow of logic:– Request radius of circle– Calculate area = pi * radius ^ 2– Output area
![Page 9: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/9.jpg)
Steps in C programming cycle
• Use editor to create source code
• Compile source code into object code
• Link object file into executable file
• Execute file
![Page 10: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/10.jpg)
Use editor to create source code
• Any editor can be used– Editor supplied with language
• Any text based editor
• DOS editor
• Notepad
• Write program following syntax of language
• Save file as: filename.c
![Page 11: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/11.jpg)
Compile Source Code
• Different compilers use different commands
• Most (such as Borland, Code Warrior) have IDE - can compile via GUI interface
• Process creates a new file: filename.obj
• This file is object code - in format readable by machine
![Page 12: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/12.jpg)
Link object file
• Most compilers will do this via GUI interface as well (may combine compiling and linking)
• Links internal C library functions (such as printf, scanf) with source code
• Creates new file: filename.exe
![Page 13: CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C](https://reader035.vdocuments.mx/reader035/viewer/2022072014/56649e875503460f94b8b2fa/html5/thumbnails/13.jpg)
Execute Program
• Program can now be executed– Type filename at DOS prompt– Most compilers allow program to be run via
GUI interface• may combine compiling, linking, and running
• Finished product can be shared– source code does not have to be shared
CSCI-370 C omputer Networks: Shrinking the globe one click at a time Lecture 6 Khurram Kazi CSCI 370
CSCI 370 CSCI-370 C omputer Networks: Shrinking the globe one click at a time Lecture 1 Khurram Kazi