Professional Documents
Culture Documents
Lab 9
Lab 9
Lab 7
Topic Pointers + 1D Regrow and Shrink
• Pointer Hazards
o Explaining Memory Leak
o Discuss Heap Memory Overflow
o Auto Growing of 1D arrays
o Need of Auto Growing Arrays
Objective o Technique for Growing 1D Arrays Automatically
o Auto Shrink of 1D Arrays
o Need for Auto Shrink Arrays
o Technique for Shrinking 1D Arrays Automatically
Note: Use Pointers and Functions to solve all questions. Also Implement the
Regrow and Shrink Functions.
Lab Tasks
Task 1: Even Numbers Array
Write a program in C++ that takes a number from a user and generate even numbers till that
number. Again, ask a number a from user and removes that number from the array.
Example 1:
Number 1: 20
Array: 0 2 4 6 8 10 12 14 16 18 20
Number 2: 14
Modified Array: 0 2 4 6 8 10 12 16 18 20
1
Example 2:
Number 1: 20
Array: 0 2 4 6 8 10 12 14 16 18 20
Number 2: 13
Modified Array: 0 2 4 6 8 10 12 14 16 18 20
2
Task 4: Vowels Characters
Write a program in C++ that reads a sentence from user. Delete the vowels characters from the
sentence.
Example:
Sentence = This is your PF Lab
Modified Sentence = Ths s yr PF Lb