110 likes | 120 Views
Learn about the differences between Java and C, explore why operating systems are written in C, and understand the advantages and disadvantages of pointers in programming. Discover the benefits of C and Java, examine variables used by functions, and delve into how values are passed and returned in functions. Dive into the consequences of using global variables, avoiding arithmetic on characters, and explore practical programming examples.
E N D
CSC 253 Lecture 2
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?
Pointers • Advantages? • Disadvantages?
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?
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.
Let’s write a program to • look at the bits in INT_MAX and see how it’s represented in our computer.