CSC209H1 Lecture Notes - Memory Address, C Dynamic Memory Allocation, Memory Management

64 views3 pages
24 Apr 2013
School
Course
Professor

Document Summary

Ex. declare a" as an array of 10 ints int a[10]; Static initialization char letters[4] = { a , q , e , r }; For(i=0; i < n; i++) { /*n == max size */ a[i] = 0: warning: it is the programmer"s responsibility to keep track of the size of an array. Pointers size = 4 bytes: a pointer is a higher-level version of an address, a pointer has type information, a pointer evaluates to the memory address they contain & their type, synatx. Declaring a pointer-to-a-type: char *cptr; /* @ 0x80493e0 */ Memory is allocated to store the pointer. No memory is allocated to store what the pointer points to. Also, p is not initialized as a valid address or null. Obtain the value"s address, and store it in the memory location referred to by the pointer"s address: char c = "a";

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