EECE 2160 Lecture Notes - Lecture 2: Memory Management, Null Pointer, Dereference Operator

71 views10 pages

Document Summary

Before a c program starts running, the os places variables in a specific position in a large memory space. On 32 bit machines, this memory space is composed of 2^32 byte positions. A pointer is a 32-bit integer number that can refer to any of these positions. The address-of operator int x = 10; printf( %p \n , &x) Int *x x is a memory address pointing to a region of memory that contains a variable of type int . If we don"t initialize the variable, it can point to anything, even if that anything is an invalid memory location. Regardless of type of the variable, it occupies 32 bits. Is used to access (read or write) the memory content referenced by a pointer. int x = 10; int *p = &x; x. *p = 20; equivalent to x = 20; Variable v is the base address of a sequence of ten initialized consecutive 4-byte signed integers.

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