Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define ui_T int
- struct node
- {
- int val;
- node* next;
- };
- void add(node** L,ui_T valoare)
- {
- node* newN = new node;
- newN->val = valoare;
- newN->next=NULL;
- if(*L==NULL)
- {
- *L=newN;
- return;
- }
- node* p= *L ;
- while(p!=NULL)
- p=p->next;
- p=newN;
- }
- void read(node* L)
- {
- ui_T valoare,n;
- cin>>n;
- for(ui_T i=0;i<n;i++)
- {cin>>valoare;
- add(&L,valoare);
- }
- while(L)
- {
- cout<<L->val;
- L=L->next; }
- }
- int main ()
- {
- node* L;
- read(L);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement