Our reference
- Chapters 1 to 8 of An Introduction to the C Programming Language and Software Design
But let’s start with some Fall 2015 CSCI 255 notes on C vs Java or the Fall 2011 ECE 209 C overview.
Chapter 1 — Introduction
- Designed to compete with assembly language
- Has a
goto
- No objects
if
,while
andfor
- but
the condition is an
int
not aboolean
- but
the condition is an
- C preprocessor
Chapter 2 — Types, Operators, and Expressions
- Similar integer types to Java but no standardization of size
- No boolean,
int
does the job - No
byte
in C - Java
char
is like a Cunsigned short
- No boolean,
- Standard C I/O is important and influenced Java I/O (more O than I)
- Similar cast operations, but narrowing without cast is allowed
Chapter 3 — Branching and Iteration
- Looks like Java with a
goto
Chapter 4 — Functions
- functions are not methods
- C has function prototypes to specify the
function interface
- See
fprintf
man page
- See
exit
is a bailout- The
main
function returns an integer to indicate success or failure- Success is usually 0 — see mkdir
- C standard library has many useful functions
Chapter 5 — Scope and Extent
Chapter 7 — Pointers
- Draw elements of the following types
int *
char *
int **
void *
- Two new operators
- unary
&
— address-of - unary
*
— dererence - study examples on page 50
- unary
- Examples of assigned to pointers and pointers to pointers
- The
const
declaration modifiesconst int* pA ;
int const* pB ;
- call by reference (vs call by value)
- Write an integer swap routine
- C++ reference
strtol
man page — this is hard
- arrays are constant pointers
- the mysteries of pointer arithemetic
- passing a function with pointers
- Spring 2017 CSCI 255 notes
- Problem 15 of Spring 2017 CSCI 255 final
- Fall 2011 ECE 209 notes