CSE 15 Lecture Notes - Lecture 3: Segmentation Fault, Entry Point, Scanf Format String

19 views6 pages
17 Apr 2017
School
Course
Professor

Document Summary

Computer"s memory is made up of bits (1s and 0s) which are organized into bytes. A computer"s memory can be visualized via stacked addresses: addresses point towards one byte, divisible by 4, variables are alias for numbers. Each byte in a computer has an address, is a location. What"s in the memory: x = 17 x is l-val. What is in the memory location labeled by y. I take what"s in y and put it in x. Messing that up: int x, y: int *p, p = *x. *b = 17 a[0] = 17: b is alias for a, and both are aliases for the same chunk of memory b[3] == a[3, number between brackets must be int. *b = b[0] = a[0: history: integer and pointer were the same in early days of c, pointers have a type associated with them. *(b+1) = b+4 1 integer, 4 bytes *(b+1*sizeof(int)) *(b+1*sizeof(int): adding/subtracting integers from pointers = good, multiply/divide = bad.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents