title: How to skip/ignore a specific position (on a list) within a loop, in C language?
body: <p>A beginner in C language, I have to find the second and third smallest numbers from a list of N numbers.</p>
  
  <pre><code>void MenordeN (int N, int lista[100], int *c,int *posicion)
  {
  int menor,cont;
  menor=lista[0];
  for (cont=1;cont&lt;N;cont++)
  {
      if (lista[cont]&lt;menor)
      {
          menor=lista[cont];
          *posicion= cont+1;
      }
  }
  *c=menor;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>int main()
  {
  int lista[100],menor, n, con,res,pos;
  printf("Ingrese el valor de N: \n");
  scanf("%i",&amp;n);
  printf("Ingrese %i numeros: \n",n);
  for (con=0;con&lt;n;con++)
  {
      scanf("%i",&amp;lista[con]);
  }
  MenordeN(n,lista,&amp;res,&amp;pos);
  printf("El elemento menor es: %i en posicion %i",res,pos);        //*res is the answer(smallest number)
  </code></pre>
  
  <h2>As of now: void MenordeN is to find the smallest number and its position. Main calls void MenordeN. However, how do I skip posicion[res] so that I can call void MenordeN again to find the second smallest number?</h2>
  
  <pre><code>int low = lista[0],m,i,idx; // init with first array element.
  m = low;
  for( i=0; i&lt;3; ++i)
  {
      for(idx=0; idx&lt;=100; ++idx)
      {
          if (lista[idx]&gt;low)
          {
              m = MIN(m,lista[idx]);
          }
      }
  }
  printf("\n3rd lowest value is %d\n", m);
  
  return 0;
  </code></pre>
  
  <h2>----->This just prints the first value entered, not the third smallest.</h2>
  
  <pre><code>int main()
  {
  int lista[100],menor, n, con, res, pos,resp;
  printf("Ingrese el valor de N: \n");
  scanf("%i",&amp;n);
  printf("Ingrese %i numeros: \n",n);
  for (con=0;con&lt;n;con++)
  {
      scanf("%i",&amp;lista[con]);
  }
  MenordeN(n,lista,&amp;res,&amp;pos);
  printf("El elemento menor es: %i en posicion %i",res,pos);
  res=NULL;
  MenordeN(n,lista,&amp;resp,&amp;pos);
  printf("\nEl segundo elemento menor es: %i en posicion %i",resp,pos);
  return 0;
  </code></pre>
  
  <p>---------------> I know this is wrong, but isn't there something simpler like res=NULL or lista[res]==NULL? My teacher wouldn't expect anything too complicated because we are still in programming I. </p>