fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int reverse(node*&head)
  5. {
  6. node*c = head;
  7. node*p = NULL;
  8. node*n;
  9.  
  10. while(c!=NULL)
  11. {
  12. n = c->next;
  13. c -> next = p;
  14. p=c;
  15. c=n;
  16. }
  17. head = p;
  18. }
  19.  
  20. void print(node*head)
  21. {
  22. node *temp = head;
  23. while(temp!=NULL)
  24. {
  25. cout<<temp->data<<" ";
  26. temp = temp->next;
  27. }
  28. }
  29.  
  30.  
  31. int main()
  32. {
  33. int n;
  34. cin>>n;
  35. reverse(head);
  36. print(head);
  37. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
5 
10 20 30 40 50
compilation info
prog.cpp:4:13: error: ‘node’ was not declared in this scope
 int reverse(node*&head)
             ^~~~
prog.cpp:4:19: error: ‘head’ was not declared in this scope
 int reverse(node*&head)
                   ^~~~
stdout
Standard output is empty