w3b - The C Programming Language ! ! ! ! C is a high-level...

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

View Full Document Right Arrow Icon
1 The C Programming Language • C is a high-level language — structured • C is a low-level language — machine access • C is a small language, extendable with libraries • C is permissive: assumes you know what you’re doing • Good: efficient, powerful, portable, flexible • Bad: easy to make errors, obfuscation, little support for modularization
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Intro to C #include <stdio.h> int main() { int i; extern int gcd(int x, int y); for (i = 0; i < 20; i++) { printf("gcd of 12 and %d is %d\n", i, gcd(12,i)); } return (0); }
Background image of page 2
3 The rest of the file int gcd(int x, int y) { int t; while (y) { t = x; x = y; y = t % y; } return (x); }
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 About C • Similar to Java - Java took best of C • #include - use for declarations of functions • main() returns int, the exit status • Functions must be – declared - tells compiler how to use function – defined - creates the item • Declarations must appear before code
Background image of page 4
5 Basic Control Structures • Functions - can omit extern declaration • for
Background image of page 5

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

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

This note was uploaded on 04/10/2010 for the course CSC CSC209 taught by Professor Kante during the Spring '10 term at University of Toronto- Toronto.

Page1 / 14

w3b - The C Programming Language ! ! ! ! C is a high-level...

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

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