Guest User

Untitled

a guest
May 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "lista.h"
  4. struct elemento *inserimento(char str[20],int n )
  5. {
  6. struct elemento *p,*aus;
  7. int i;
  8. p=(struct elemento *)malloc(sizeof(struct elemento));
  9. p->inf=str[0];
  10. printf("%c",p->inf);
  11. aus=p;
  12. aus=aus->next;
  13. aus=(struct elemento *)malloc(sizeof(struct elemento));
  14. for(i=0;i<n;i++)
  15. {
  16. aus->inf=*str++;
  17. aus->next=(struct elemento *)malloc(sizeof(struct elemento));
  18. aus=aus->next;
  19. }
  20. return p;
  21. }
  22. void stampa(struct elemento *p)
  23. {
  24. while(p!=NULL)
  25. {
  26. printf("%c --> ",p->inf);
  27. p=p->next;
  28. }
  29. printf("NULL");
  30.  
  31.  
  32. }
Add Comment
Please, Sign In to add comment