# CSCI 255 Final Exam Review

## Reference card

Three reference sheets will be available for you during the exam. The C reference card has much more than you need to know about C.

Additionally I am working on a reference sheet covering topics in Chapters 6 and 8.

## Chapters covered

The second exam covers Chapters 1 to 4, 6, and 8 of the textbook.

## Homework and assignments covered

The exam will concentrate on topics covered by homework and assignments. There will be also be some "review" problems from Exam 1 and and Exam 2.

## Pointers

Unlike the second exam, this one really will cover pointers. So, let's do this example!

Pointers are in C, but not in Java. A recent CSCI 373 exam asked students to draw the pointers and give the output generated by the following program. If you can do this, you have truly master pointers.

```  int a, b ;
int *p, *q ;
int v[2] ;
a = 10 ;
b = 20 ;
for (a = 0; a<2; ++a) {
v[a] = 30 + a*10 ;
}
printf("%d %d %d %d\n", a, b, v[0], v[1]) ;

p = &a ;
*p = b + 5 ;
v[0] = *p + 7 ;
printf("%d %d %d %d\n", a, b, v[0], v[1]) ;

p = &a ;
q = &b ;
*p = *q ;
*q = *p ;
printf("%d %d %d %d\n", a, b, v[0], v[1]) ;

q = &v[0] ;
p = q ;
b = *++q ;
a = ++*p ;
printf("%d %d %d %d\n", a, b, v[0], v[1]) ;

p = &v[0] ;
q = &v[1] ;
a = q-p ;
b = *q-*p ;
printf("%d %d %d %d\n", a, b, v[0], v[1]) ;
```