2__Questions_MemAlloc_10

2__Questions_MemAlloc_10 - CIS 15BG 1 Questions Chapter 10:...

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

View Full Document Right Arrow Icon
CIS 15BG Questions Chapter 10: POINTER APPLICATIONS Memory Management 1. Write fragments of code to allocate memory as specified below. Validation: if not enough memory, print a message using MEM_ERROR and exit. #define MEM_ERROR printf("Not enough memory!\n") (A) . Allocate a double using malloc. Validation required. // Local Definitions // Statements (B). Allocate a double using calloc . Validation required. // Local Definitions // Statements (C). Allocate a list of n integers using malloc . Validation required. // Local Definitions // Statements 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
CIS 15BG Questions Chapter 10: POINTER APPLICATIONS Memory Management (D). Allocate a list of n integers using calloc . Validation required. // Local Definitions // Statements (E). Change the size of a dynamically allocated list from the existing size to m integers. Assume m > 0. Validation required. // Local Definitions // Statements 2. Given the following local definitions: (A). char a[10]; (F). int (*ptr)[10]; (B). char *a[10]; (G). int
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/02/2011 for the course CIS 15BG taught by Professor Staff during the Winter '10 term at DeAnza College.

Page1 / 4

2__Questions_MemAlloc_10 - CIS 15BG 1 Questions Chapter 10:...

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

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