codice:
for (i=0;i<n;i++)
 {
      for (j=0;j<n;j++)
     {
           p = (struct elemento*)malloc(sizeof(struct elemento));
           if (i==0) 
               p->prev = NULL;
           if (j==0) 
               p->su = NULL;
            printf("\nInserisci il primo valore: ");
            scanf("%d", &p->inf);
           puntcorr = p;
           while(j<=n)
          {
                 puntcorr->next = (struct elemento *)malloc(sizeof(struct elemento));
                 puntcorr->next->prev=puntcorr;
                 puntcorr = puntcorr->next;
                 printf("\nInserisci il %d elemento: ", j);
                 scanf("%d", &puntcorr->inf);
                  j++;
           } // chiudo il while
         if(i==1)
          {
               sotto=p;         
               sotto->su=p;
               while(j<=n)
               {
                        sotto->next = (struct elemento *)malloc(sizeof(struct elemento));
                        sotto->next->prev=sotto;
                        sotto = sotto->next;
                        printf("\nInserisci il %d elemento: ", j);
                        scanf("%d", &sotto->inf);
                          j++;
                 } // chiudo il while
            puntcorr->next = NULL; // marcatore fine riga-lista
          }
      }
 } // chiudo l'if-else
 return(p);
 } // chiudo la funzione