Page 83 - DCAP407_DATA_STRUCTURE
P. 83
Data Structure
• Memory can be allocated and deallocated dynamically by using functions such as, malloc(),
calloc(), realloc(), free().
• Since pointers can produce bugs, they should be used with caution as debugging becomes
complicated.
• Record is a collection of non-homogenous data.
• Structures are used to store non-homogenous data.
4.9 Keywords
Bug: A fault in the code or routine of a program
Contiguous Memory: Memory which is not fragmented into smaller blocks and arranged in different
locations.
CPU Registers: Special memory locations constructed from flip-flops.
Junk Value: When no value has been assigned to a particular field in a database, the field contains a
value called as junk value.
4.10 Self Assessment
1. State whether the following statements are true or false:
(a) Pointer can be declared as int d.
(b) Dangling pointer is a pointer which points to the data.
(c) Memory is deallocated using malloc().
(d) Records should not contain non-homogenous data.
(e) Pointer operation” m1+m2” is valid.
(f) A file is a collection of similar records.
2. Fill in the blanks:
(a) Memory can be deallocated using ………………………
(b) Pass by value allows ……………………… transfer of data.
(c) ……………………… is used to allocate a block of memory.
(d) Dangling pointer is also known as………………………
(e) In pass by value, ………………………can be passed as arguments.
3. Select a suitable choice for every question:
(a) Pointer to pointer is declared as:
(i) int **p;
(ii) int p;
(iii) int *p;
(iv) int p*;
(b) Pointer is declared as:
(i) int (p);
(ii) int p;
(iii) int *p;
(iv) int **p;
76 LOVELY PROFESSIONAL UNIVERSITY