1 Define a pointer to store the address of a value x 2 Defin
1. Define a pointer to store the address of a value \'x\'.
2. Define a pointer to store the address of a vector of strings.
3. Consider the statement: int* p = new int[20]; How do you deallocate the memory just allocated?
Solution
Question 1
Answer:
int x =10;
int *p = &x;
Question 2
Answer:
vector<string> v (5);
string *p = v.data();
Question 3
Answer:
int* p = new int[20];
delete p;
