{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture 2

# 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 space

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 000C 0010 0014 00 27 D0 3C 0018 001C 0020 0024 35 University of Washington Assignment in C   Leo ­hand ­side = right ­hand ­side   LHS must evaluate to a memory LOCATION   RHS must evaluate to a VALUE (could be an address)   E.g., x at locaJon 0x04, y at 0x18   x originally 0x0, y originally 0x3CD02700   int * x; int y; x = &y + 3; // get address of y add 12 // 0x0018 + 0x000C = 0x0024 *x = y; // value of y copied to // locaGon to which x points Memory 0000 24 00 00 00 0004 0008 000C 0010 0014 00 27 D0 3C 0018 001C 0020 0024 36 University of Washington Assignment in C   Leo ­hand ­side = right ­hand ­side   LHS must evaluate to a memory LOCATION   RHS must evaluate to a VALUE (could be an address)   E.g., x at locaJon 0x04, y at 0x18   x originally 0x0, y originally 0x3CD02700   int * x; int y; x = &y + 3; // get address of y add 12 // 0x0018 + 0x000C = 0x0024 *x = y; // value of y copied to // locaGon to which x points Memory 0000 24 00 00 00 0004 0008 000C 0010 0014 00 27 D0 3C 0018 001C 0020 00 27 D0 3C 0024 37 University of Washington Arrays   Arrays represent adjacent locaJons in memory storing the same type of data object   e.g., int big_array[128]; allocates 512 adjacent bytes in memory starGng at 0x00ﬀ0000   Pointer arithmeJc can be used for array indexing in C (if pointer and array have the same type!):   int *array_ptr; array_ptr = big_array; 0x00ﬀ0000 array_ptr = &big_array[0]; 0x00ﬀ0000 array_ptr = &big_array[3]; 0x00ﬀ000c array_ptr = &big_array[0] + 3; 0x00ﬀ000c (adds...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern