Page 84 - DCAP407_DATA_STRUCTURE
P. 84
Unit 4: Pointers
(c) Two-dimensional array can be represented using pointers as:
(i) data_type(*p)[ep1];
(ii) data_type(**p)[ep2];
(iii) data_type(*p)[ep2];
(iv) data_type (*p)[*ep];
(d) In pointers, reference operator is:
(i) &
(ii) @
(iii) $
(iv) ^
(e) Equality operator can be applied only if:
(i) Both operators are null
(ii) One operator is null
(iii) Operators are strings
(iv) Operators are characters.
4.11 Review Questions
1. “int *a;
int *b;
int *c;
c= a+b”. Is this a valid operation? Justify.
2. “The address which locates a variable within the memory is a reference to that variable.” Explain.
3. “There are many functions which can be used for dynamic memory allocation and deallocation.”
Name and explain the functions.
4. “typedef keyword can be used to assign name to type definition.” Explain.
5. “Multidimensional array can be represented in terms of an array of pointers.” Explain.
6. “Record is a collection of data items.” Discuss.
7. “The function which is called by reference will change the values of the variable used in the call.”
Comment.
8. “Wild pointer is a pointer which does not point to a valid memory location.” Discuss.
9. “A record which is a collection of data items differs from a linear array.” Explain.
10. “Pointers can be used in function declaration.” Describe.
11. “An array can be considered as an internal or hidden pointer.” Comment.
12. “Records can contain a collection of non-homogenous data.” Explain.
Answers: Self Assessment
1. (a) False (b) False (c) False (d) False (e) False (f) True
2. (a) free() (b) one-way transfer (c) malloc() (d) Wild pointer (e) Expressions
3. (a) Int *p; (b) int **p; (c) data_type(*p)[ep2]; (d) & (e) one operator is null
LOVELY PROFESSIONAL UNIVERSITY 77