CS240: Programming in C

CS240: Programming in C

CS240: Programming in C Lecture 1: Class overview. Cristina Nita-Rotaru Lecture 1/ Fall 2013 1 Why learn C (1) ! C is one of the foundations for CS: " Contains/applies principles from programming languages, computer architectures, operating systems, network communication, database, graphical user interface (GUI), graphics, image processing, parallel processing, multi-threads, real-time systems, device drivers, data acquisition, algorithms, numerical analysis, and computer game. Cristina Nita-Rotaru Lecture 1/ Fall 2013 4 What does this buy you? ! Understanding: understand better the interaction between machine and software: " “…teaches individuals how computers really work” " “…built a foundation you’ll be thankful for every 300+ level course ” Cristina Nita-Rotaru Lecture 1/ Fall 2013 5 Why learn C (2) ! C is the most commonly used programming language in industry. " Next two popular are Java and C++ " Language of systems programming: low-level control over the OS, networking, crypto operations, email, games, embedded systems have higher performance when written in C http://www.langpop.com Cristina Nita-Rotaru Lecture 1/ Fall 2013 6 What does this buy you? ! Helps you be as prepared as possible for a job: " Most of the employers want candidates to know multiple languages " Will prepare you better for a job interview " Gives you more opportunities within a company Cristina Nita-Rotaru Lecture 1/ Fall 2013 7 Why learn C (3) ! C is the base for almost all popular programming languages. ! Because of the performance and portability of C, almost all popular cross-platform programming languages and scripting languages, such as C++, Java, Python, Objective-C, Perl, Ruby, PHP, Lua, and Bash, are implemented in C and borrowed syntaxes and functions heavily from C. ! Almost all languages can interface with C and C++ to take advantage of a large volume of existing C/C++ libraries. Many of their toolkits, modules or packages are written using C or C++. Cristina Nita-Rotaru Lecture 1/ Fall 2013 8 What does this buy you? ! It will help you learn quickly other languages ! It will allow you to interface with many other languages Cristina Nita-Rotaru Lecture 1/ Fall 2013 9 Reference material ! The C Programming Language, Brian W. Kerninghan and Dennis M. Ritchie, 2nd Edition ! Lecture slides posted online Cristina Nita-Rotaru Lecture 1/ Fall 2013 23 How to study ! Read the book, reference material, slides, man pages ! Code each example from class, don’t just read it, code it ! Do the labs and projects ! Do the practice exercises from lectures ! Start small, then add functionality ! Make mistakes and observe output ! Make sure you always understand why it did not work and why the solution works Cristina Nita-Rotaru Lecture 1/ Fall 2013 26 Terminology ! What’s a computer? ! What is hardware/software ! What’s an algorithm ? ! What’s a program? ! What’s an operating system? ! What’s a programming language ? " Machine language " Assembly language " High-level language Cristina Nita-Rotaru Lecture 1/ Fall 2013 31 Computer architecture Mouse Memory Network Keyboard CPU Display Storage Cristina Nita-Rotaru Lecture 1/ Fall 2013 32 APPLICATIONS OPERATING SYSTEM HARDWARE Cristina Nita-Rotaru Lecture 1/ Fall 2013 33 OS Job ! Management of the processes and their access to resources " Memory " CPU access " I/O " Network " Other devices ! Interaction with the user " Graphic interface " Other devices Cristina Nita-Rotaru Lecture 1/ Fall 2013 34 Algorithm/Program ! Algorithm: procedure for solving a problem in finite steps ! Program: set of instructions to the CPU, stored in memory, read and executed by the CPU Cristina Nita-Rotaru Lecture 1/ Fall 2013 35 Machine and assembly language ! Machine language : binary information, specific to a CPU " How a CPU interprets data: e.g. how are memory addresses represented, how is an instruction coded, etc " This is the binary or executable code ! Assembly language: easier to write for people, using symbols, requires an assembler " Still need to think in terms of low level CPU steps " Still hardware-specific Cristina Nita-Rotaru Lecture 1/ Fall 2013 36 High-level language ! Closer to human language ! Needs a compiler to convert it to machine language ! One can write programs in many high-level languages for the same CPU ! More portable ! Examples: C, C++, C#, Objective C, Java, SmallTalk, also Cobol, Basic, Pascal … Cristina Nita-Rotaru Lecture 1/ Fall 2013 37 Readings for next lecture K&R Chapter 1: A tutorial introduction Cristina Nita-Rotaru Lecture 1/ Fall 2013 38 .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    17 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us