Notes - 3.18 - EE 312 Notes - - - - - - - - Malloc = sets a...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
- = Malloc sets a memory block for the size of bytes you need o Used as a pointer o : = ( ( )); Ex p malloc sizeof int o Will return null if cannot find size o Make sure to check for null - = , Calloc allocates space for an array with num of elements each element beings bytes long o * ( , ) Void calloc size_t num size_t size o Does set all memory block locations to 0 o : * , , ; Ex int a size I o (“ :”); Printf enter the number of array elements o ”); Scanf d size o = ( , ( )); A calloc size sizeof int - Free function o When requesting two different space pointers and setting them to each other o We call this garbage o Use free function so that we don t lose one sets memory o (* ) Free pointer o Don t use after freeing the memory - Linked List o Each node in list is the same type o May contain information o Also contains a pointer o To the next element in a list o To indicate the list is empty * = Set pointer first null o If not empty * temp = ( ( )); temp
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/22/2008 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas at Austin.

Page1 / 3

Notes - 3.18 - EE 312 Notes - - - - - - - - Malloc = sets a...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online