title: correct way to change values of c pointers
body: <p>Sorry, another C pointer question.. I have a function func() that sorts an array, then get the largest and smallest integers. I'm trying to put them inside pointer variables in main() but the values are only correct inside the func() function. I don't understand why :(</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void func(int arr[], int *s, int *l, int n){
      int i = 1;
      for(; i &lt; n; i++){
          int temp = arr[i];
          int n = i;
          while( n &gt; 0 &amp;&amp; arr[n-1] &gt; temp){
              arr[n] = arr[n-1];
              n--;
          }
          arr[n] = temp;
      }
      l = &amp;arr[n-1];
      s = &amp;arr[0];\
      printf("%d %d\n",*l,*s);
  }
  
  int main(void){
      int arr[] = {1,2,9,3,58,21,4};
      int *s, *l;
      int size = 7;
      func(arr,s,l,size);
      printf("%d %d\n",*l,*s);
  } 
  </code></pre>