









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences
CS61c B. Harvey Fall 2003 J. Wawrzynek
char a[14] = "pointers in c"; char c = 'b'; char *p1 = &c, **p2 = &p1;
p1 = a + 5;
&p1 = &a[0];
p2 = a;
*(a + 10) = 't';
*p2 = &c;
struct point { union { int i; double d; } x; union { int i; double d; } y; } p[10];
int i;
for(i=0; i<10; i++) { p[i].x.i = 0; p[i].y.i = 0; }
la $8, p # $8 points to p[0]
addi $9, $8, ______ # $9 points to p[10]
L1: bge $8, $9, L2 # done if past end of array
sw ____, 0($8) # p[i].x.i = 0
sw ____, ____($8) # p[i].y.i = 0
addi $8, $8, ______ # i++ b L
L2:
struct node { int value; struct node *next; };
struct node *mergesort(struct node *list) { if (list == 0 || list->next == 0) return list; return merge(mergesort(evens(list)), mergesort(odds(list))); }