C C trio@seu.edu.cn C
C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40
Week3 C Week5 Week5 Memory & Pointer Week7 (Data structure & Link List) Week9 Interrupt & Device Driver Week11 Coding Style Week11 Week13 ASIX OS Simulator Week13 ASIX Windows GUI Week15 ASIX Windows GUI Week15 ASIX Windows Course Project MS VC++ ASIX OS Simulator ASIX Window ASIX Windows ASIX Windows
ASIX OS Simulator 120
C 1 C (The C Programming Language ) Brian W.Kernighan, Dennis M.Ritchie C Brian W. Kernighan Dennis M. Ritchie C 2 C Primer Plus (C Primer Plus) Stephen Prata Primer Plus C Primer Plus( ) C 3 C (Pointers on C) Kenneth A.Reek C C C 1 C (C Traps and Pitfalls) Andrew Koenig 1985 Bell C C C 2 C (Expert C Programming ) Perter Van Der LinDen C C++ C 3 C (C Programming : Just the Faqs ) Paul S.R.Chisholm c
(1) C/C++ (Programming Embedded Systems in C and C++) Michael Barr (2) C/OS-II (MicroC/OS-II The Real-Time Kernel) Jean J.Labrosse C/OSII C/OSII C/OSII CPU (3) (Embedded Systems Building Blocks ) Jean J.Labrosse / C (1) http://www.csdn.net/ IT (2) C http://ols3.tnc.idv.tw/prg/cpp/ccfaq/ccfaq.html C-FAQ (2004 7 3 ) (3) Programming in C http://www.lysator.liu.se/c/index.html C E
QUIZ 1 a a) An integer b) A pointer to an integer c) A pointer to a pointer to an integer d) 10 An array of integers e) 10 An array of 10 pointers to integers f) A pointer to a function that takes an integer as an argument and returns an integer g) 10 An array of ten pointers to functions that take an integer argument and return an integer
2 static 3 const
4 volatile? 5 a a bit 3 a bit 3
6 0x67a9 0xaa66 ANSI 7 C interrupt interrupt (ISR) interrupt double compute_area (double radius) { double area = PI * radius * radius; printf(" Area = %f", area); return area; }
8 void foo(void) { unsigned int a = 6; int b = -20; (a+b > 6)? puts("> 6") : puts("<= 6"); } 9 C, int a = 5, b = 7, c; c = a+++b;
Answer! Quiz 1 Answer a) int a; // An integer b) int *a; // A pointer to an integer c) int **a; // A pointer to a pointer to an integer d) int a[10]; // An array of 10 integers e) int *a[10]; // An array of 10 pointers to integers f) int (*a)(int); // A pointer to a function a that takes an integer argument and returns an integer g) int (*a[10])(int); // An array of 10 pointers to functions that take an integer argument and return an integer
Quiz 2 Answer C static 1). 2). 3). Quiz 3 Answer const int a; int const a; const int *a; int * const a; int const * a const; a a a a
CONST const const const const bug Quiz 4 Answer volatile volatile 1). 2). (Non-automatic variables) 3).
Quiz 5 Answer #define BIT3 (0x1<<3) static int a; void set_bit3(void) { a = BIT3; } void clear_bit3(void) { a &= ~BIT3; } int *ptr; ptr = (int *)0x67a9; *ptr = 0xaa55; Quiz 6 Answer
Quiz 7 Answer 1). ISR 2). ISR 3). / / / ISR ISR ISR 4). printf() Quiz 8 Answer >6-20 6
Quiz 9 Answer c = a++ + b;, a = 6, b = 7, c = 12 :