Advertisement
Guest User

Untitled

a guest
May 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void adaugare(nod *&p,int x)
  5. {
  6. if(p==NULL)
  7. {
  8. p=new nod;
  9. p->info=x;
  10. p->urm=NULL;
  11. }
  12. else
  13. {
  14. nod *q=p;
  15. while(q->urm!=NULL)
  16. q=q->urm;
  17. nod *nou;
  18. nou=new nod;
  19. nou->info=x;
  20. q->urm=nou;
  21. q=nou;
  22. q->urm=NULL;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement