1 / 6

C Programming Chapters 11, . . .

C Programming Chapters 11,. C – Compiler Compilation Tracing C programs C Functions C program Stack Structure. Memory map. (Global Data pointer). I/O Devices. C Functions. All C programs begin with the main Function: #include <stdio.h> ; include libraries for compiler

issac
Télécharger la présentation

C Programming Chapters 11, . . .

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. C ProgrammingChapters 11, . . . • C – Compiler Compilation • Tracing C programs • C Functions • C program Stack Structure

  2. Memory map (Global Data pointer) I/O Devices

  3. C Functions All C programs begin with the main Function: #include <stdio.h> ; include libraries for compiler #define Two = 2 ; “Two” will be replaced in code with 2 int x = 56; ; x is a global variable int main () ; main has an “int” type return value { int y = 47; ; y is a local variable return 0; ; return the value “0” }

  4. C Functions #include <stdio.h> int sum (int r, int s, int t); int main() { z = sum (x,y,z) + 65; } int sum (int A, int B, int C) { int total; ; total is a local variable total = A + B + C); return total; ; return the sum }

  5. C Program int Func1(int x) { return Func2(x) + 1; } int Func2(int x) { return Func3(x) + 1; } int Func3(int x) { return Func4(x) + 1; } int Func4(int x) { return x + 1; } #include <stdio.h> int Func1(int x); int Func2(int x); int Func3(int x); int Func4(int x); int main() { int A = 3; int B = 5; int C; C = A + B; C = Func1(C); C = C + 1; return 2; }

  6. C Program Compilation • Compile the program • Look at the files • Load them into the LC-3 simulator • Execute the program and observe its stack

More Related