Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 253 Lecture 2.

Similar presentations


Presentation on theme: "CSC 253 Lecture 2."— Presentation transcript:

1 CSC 253 Lecture 2

2 Some differences between Java and C

3 C vs. Java Why are OSs written in C?
Two steps in the Java compile-run sequence are “skipped” with C. What two steps? What’s the advantage of skipping them? What’s “bad” about skipping them? Advantage: Can optimize code for specific platform. For real-time computing, you need to know how long it takes to run code. Disad.: Need to distribute different binaries for every system code runs on. Will your libraries all run on these different machines? If you run over the Web, you will need to use Java or some other portable language.

4 Pointers Advantages? Disadvantages?
Directly control memory—when it’s allocated & deallocated. C does not natively offer a GUI, thread support, exception handling or packaging

5 Summary: Advantages of C

6 Summary: Advantages of Java

7 Variables used by > 1 function
Should they be … Global? How can such a value be passed into a function? How can such a value be returned from the function?

8 Why not use lots of globals?
One reason: Clutters namespace

9 Why should you not do arithmetic on characters?

10 Let’s write a program to …
determine the value of INT_MAX; that is, show an integer i that prints as positive, whereas i+1 prints as negative.

11 Let’s write a program to
look at the bits in INT_MAX and see how it’s represented in our computer.


Download ppt "CSC 253 Lecture 2."

Similar presentations


Ads by Google