03-C-not-so-basics

03-C-not-so-basics - 03 - Lecture - C (not so) basics...

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

View Full Document Right Arrow Icon
03 - Lecture - C (not so) basics --------------------------------- Reading: - Chapter 5,6 C vs. Java ----------- C: - prog.c (source file) ---- [compiler] ----> prog.o (object file) - multiple object files ---- [linker] ----> executable file - objects and executables are CPU-specific and OS-specific Java: - prog.java (source file) ---- javac ----> prog.class (byte code) - "java" (or java.exe) is the actual executable, which implements the Java Virtual Machine (JVM) - JVM runs a java program by translating machine-independent byte code into CPU/OS-specific machine instructions on the fly Variable scoping ----------------- int x; x = 0; { int x; x = 1; } printf("%d", x); Storage class -------------- 1) automatic variables - also called stack variables, since they are usually stored in process stack (we’ll see what this means later) - scope: local to a block - lifetime: created on block entrance, destroyed on exit - example: int foo(int auto_1)
Background image of page 1

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

View Full DocumentRight Arrow Icon
{ int auto_2; { int auto_3; ... } ... } 2) static variables
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 10/07/2008.

Page1 / 4

03-C-not-so-basics - 03 - Lecture - C (not so) basics...

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

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