Q:

Double pointer dereferences in a function

I'm trying to understand double pointers. I think i should be able to write (**min = 3;) in the MinMax loop below, but it is just ignored. I think it should set the value pointed to by the value of min (pointer to start) to 3 (or of course to any int). Can someone help me understand why this is crazy talk? There is no reason in the function to set this value of course, i just want to understand why it doesn't work.
int ar[] = {1,23,4,32,5,67,999,-1};
int *min= 0;
int *max= 0;
MinMax(ar,ar+8,&min,&max);

void MinMax(int *start,int *end, int **min,int **max) {
  // **min = 3; //why not?
  *min = start; 
  *max = start;
  while(++start < end) {
  if(*start < **min) *min = start;
  if(*start > **max) *max = start;
  }
}

A:

At the point you have **min = 3 the value of *min is 0, i.e. a NULL pointer, which means it doesn't point anywhere.  Attempting to dereference *min and subsequently write to it invokes undefined behavior.
The following lines set both *min and *max to point to the same place as start, so after that they can be dereferenced.

