Vector test program
Type the default size of array and the size of incrementation.
Size:
Incrementation:
myMalloc: allocating 32 bytes, memory allocated 32 bytes
myMalloc: allocating 40 bytes, memory allocated 72 bytes
myRealloc: allocating 80 bytes, memory allocated 152 bytes
myRealloc: allocating 80 bytes, memory allocated 232 bytes
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
Vector length: 20
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
Choose the value of an item:
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
vector[0]: 0
vector[1]: 5
vector[2]: 10
vector[3]: 15
vector[4]: 20
vector[5]: 25
vector[6]: 30
vector[7]: 35
vector[8]: 40
vector[9]: 45
vector[10]: 50
vector[11]: 55
vector[12]: 60
vector[13]: 65
vector[14]: 70
vector[15]: 75
vector[16]: 80
vector[17]: 85
vector[18]: 90
vector[19]: 95
vector[20]: 365
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
Choose the position of an item to be removed:
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
vector[0]: 0
vector[1]: 5
vector[2]: 10
vector[3]: 15
vector[4]: 20
vector[5]: 25
vector[6]: 30
vector[7]: 35
vector[8]: 40
vector[9]: 45
vector[10]: 55
vector[11]: 60
vector[12]: 65
vector[13]: 70
vector[14]: 75
vector[15]: 80
vector[16]: 85
vector[17]: 90
vector[18]: 95
vector[19]: 365
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
Choose the value of an item to be found:
Vector does not contain this item.
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
Choose the value of an item to be found:
Choose the initial index for searching:
Position of an item: not found
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
myFree: releasing 200 bytes, memory allocated 32 bytes
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
Vector length: 0
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
Choose the value of an item:
myRealloc: allocating 80 bytes, memory allocated 112 bytes
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
vector[0]: 8
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
myMalloc: allocating 32 bytes, memory allocated 144 bytes
myMalloc: allocating 80 bytes, memory allocated 224 bytes
copy[0]: 8
Removing the vector "copy"
myFree: releasing 80 bytes, memory allocated 144 bytes
myFree: releasing 32 bytes, memory allocated 112 bytes
Press:
1 to show the length of vector
2 to add a new item
3 to remove an item
4 to print all items
5 to find out whether an item is present
6 to find an item's position
7 to clear the vector
8 to fill a portion of the vector with desired value
9 to create a copy of a vector
0 to print one item
anything else to finish.
Freeing all allocated memory.
myFree: releasing 80 bytes, memory allocated 32 bytes
myFree: releasing 32 bytes, memory allocated 0 bytes
All allocated memory was freed.
