Guest User

Untitled

a guest
Jan 23rd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. void transfer(){
  2. typedef struct node{
  3. int data;
  4. node *next;
  5. }*nodeptr;
  6. nodeptr arrayNodes[5], listP, temp;
  7. for(int i = 0; i < 5; i++){
  8. arrayNodes[i] = new node;
  9. arrayNodes[i]->data = i - 1;
  10. }
  11. for(int i = 0; i < 5; i++){
  12. arrayNodes[i]->next = arrayNodes[i + 1];
  13. }
  14. arrayNodes[4]->next = 0;
  15. temp = arrayNodes[0];
  16. int st[4], top = 0;
  17. while(temp != 0){
  18. if(top == 4) cout<<"\nOver Flow\n";
  19. else
  20. st[top] = temp->data;
  21. temp = temp->next;
  22. }
  23.  
  24. }
Add Comment
Please, Sign In to add comment