Day 11 Recap Questions
  1. What is the difference between stack and heap memory?
  2. What is dynamic memory allocation in C?
  3. What is the memory leak problem?
  4. What is the difference between malloc, realloc, and calloc?
  5. What do we use valgrind to check for?
  6. Consider the exclaim function below. Do you see any problems with this function?
// Return a C character string containing n exclamation points.
// n must be less than 20.
char* exclaim(int n) {
  char s[20];
  assert(n < 20);
  for (int i = 0; i < n; i++) {
    s[i] = '!';
  }
  s[n] = '\0';
  return s;
}