1 / 26

Introduction to C Programming

This course provides an overview of C programming for non-CSIE majors, teaching the basics of programming and problem-solving using C language. The course covers topics such as selection structures, repetition and loops, modular programming, data types, strings, recursion, file processing, and linked lists.

Download Presentation

Introduction to C Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to C Programming計算機程式設計2/22/2012朱浩華

  2. Today’s Do List • Course Overview (20 minutes) • Setup computer accounts • “Hello world!” CodeBlocks program (30 minutes) • Overviews of Computers and Programming (50 minutes)

  3. Course Goals • First course in programming language for non-CSIE majors • Learning Learn how to become a good C programmer • Able to use the programming skill to solve problems in your fields of studies. • Computer language is a lot simpler than natural language such as Chinese (because machines are dump) • Limited vocabulary (< 100 constructs) • Simple grammar (plural, singular, …) • No ambiguity (e.g., present the present)

  4. Course Topics • Cover as much as C programming as possible (adjust based on progress) • Basics • Selection structures (if-else, switch) • Repetition and Loop (for, while, do) • Modular programming & pointers • Simple and Complex Data types (arrays) • Strings • Recursion • Structure and Union Types • File processing (<stdio.h>) • Linked list

  5. Prerequisite • Good typing skill • Non CSIE major • Read some English

  6. Textbook • Problem Solving and Program Design in C, 6th Edition, Jeri R. Hanly and Eliot B. Koffman

  7. Course Format • Weekly take-home programming assignments (13) • Midterm exam • Fixed date 4/25/2012 in class • Offer once only • Final exam • Fixed date: 6/20/2012 in class • Offer once only

  8. Grading (Tentative) • Tentative means that it may be changed later • 33%: 13 assignments • 33%: Midterm exam • 33%: Final exam

  9. Teaching Staff • Instructor: • “Hao” Chu (朱浩華) • hchu@csie.ntu.edu.tw • Office: CSIE 518 • Weekly office hours: Thu 2-3:30 pm • TA: • TimeString (何柏樟) – the master programmer • timestringalpha@gmail.com • Office: CSIE 336 • Weekly office hours: ?

  10. Means of Communications • Course homepage: http://mll.csie.ntu.edu.tw/course/comp_prog_s12/ • Send email to TA or me • Come to office hours

  11. Lecture Notes • Available on the course homepage prior to each lecture • Complement, not replacement for attending lecture • We will do plenty of programming practices during classes

  12. Roster call to see who are hereand how many extra students we can take

  13. Questions on the Administrative Things?

  14. Before writing your 1st program • Hand out computer accounts • What is a program? • A sequence of instructions that the computer executes • What is and isn’t a program? • Will use CodeBlocks to write programs. • IDE (Integrated Development Environment) • A program that makes it easy for you to write programs • Actually contains many programs • A word processor: like MS Words • A compiler: translate your text program into machine-executable code • A debugger: test the correctness of a program

  15. “Hello World” with CodeBlocks • Make sure your computer has CodeBlocks installed • Switch to programming screen • Create a new project called “helloworld” • Type in the “Hello World” program • Click on Build -> “Build and run”

  16. Overview of Computers and ProgramsChapter 1

  17. Computer Hardware

  18. PC Motherboard

  19. Hardware vs. Software • “Hello World” software program executed on the PC hardware

  20. A bit of Hardware - memory • What is memory? • Consists of memory cells – like a pill box • Each memory cell stores content or data (0s and 1s) • Each memory cell has an address (like the day) • Bits and Bytes • A bit stores one binary digits (0 or 1). • A byte = 8 bits (one char, like A)

  21. How big is 4GB (Gigabyte)? 4 * 109 bytes

  22. Memory storage units

  23. Main memory vs. secondary storage • Main memory: data loss after power loss • Secondary storage (harddisk, flash): no data loss after power loss

  24. Directory vs. file

  25. What is CPU (Central Processing Unit)? • It executes instructions (e.g., in your program)

  26. Computer Languages • High-level languages • More like English, easier to program • C, Java, Objective-C, … • Machine language • Made up of 0/1s, not easy to read • Compiler (the build command in CodeBlocks) • Translate high-level language to machine language

More Related