2008SpCS61C-L03-ddg-c1-6up

2008SpCS61C-L03-ddg-c1-6up - inst.eecs.berkeley.edu/~cs61c...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS61C L03 Introduction to C (pt 1) (1) Garcia, Spring 2008 © UCB Lecturer SOE Dan Garcia www.cs.berkeley.edu/~ddgarcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 3 – Introduction to the C Programming Language (pt 1) 2008-01-28 Hello to Dev Anand from Pune, Maharashtra, INDIA Infected Frames! Malware has been found in photo frames recently sold by Best Buy. This is not the first time this has happened in personal electronics (iPods, drives, MP3 players). Be careful! www.sfgate.com/cgi-bin/article.cgi?f=/c/a/2008/01/26/MNE7UHOOQ.DTL CS61C L03 Introduction to C (pt 1) (2) Garcia, Spring 2008 © UCB Number review. .. We represent “things” in computers as particular bit patterns: N bits 2 N Decimal for human calculations, binary for computers, hex to write binary more easily 1 ʼ s complement - mostly abandoned 2 ʼ s complement universal in computing: cannot avoid, so learn Overflow: numbers ; computers finite,errors! 00000 00001 01111 ... 11111 11110 10000 . .. 00000 00001 01111 ... 11111 11110 10000 . .. META: We often make design decisions to make HW simple CS61C L03 Introduction to C (pt 1) (3) Garcia, Spring 2008 © UCB Introduction to C CS61C L03 Introduction to C (pt 1) (4) Garcia, Spring 2008 © UCB Has there been an update to ANSI C? Yes! It ʼ s called the “C99” or “C9x” std You need “ gcc -std=c99 ” to compile References http://en.wikipedia.org/wiki/C99 http://home.tiscalinet.ch/t_wolf/tw/c/c9x_changes.html Highlights Declarations anywhere, like Java (#15) Java-like // comments (to end of line) (#10) Variable-length non-global arrays (#33) <inttypes.h> : explicit integer types (#38) <stdbool.h> for boolean logic def ʼ s (#35) restrict keyword for optimizations (#30) CS61C L03 Introduction to C (pt 1) (5) Garcia, Spring 2008 © UCB Disclaimer Important : You will not learn how to fully code in C in these lectures! You ʼ ll still need your C reference for this course. Check online for more sources “JAVA in a Nutshell,” O ʼ Reilly. Chapter 2, “How Java Differs from C” Brian Harvey ʼ s course notes On class website CS61C L03 Introduction to C (pt 1) (6) Garcia, Spring 2008 © UCB Compilation : Overview C compilers take C and convert it into an architecture specific machine code (string of 1s and 0s). Unlike Java which converts to
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

2008SpCS61C-L03-ddg-c1-6up - inst.eecs.berkeley.edu/~cs61c...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online