error: ld returned 1 exit status

compilation is fine but there is some problem in linking. But i am not able to track the error


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <iostream>
using namespace std;
class Node
{
	public:
		int data;
		Node *next;

		Node(int val)
		{
			data = val;
			next = NULL;
		}

};

Node* reverse(Node* head)
{
	if (head == NULL)
	{
		return NULL;
	}
	Node *current = head;
	Node *link = NULL, *tmp = NULL;
	while (current != NULL)
	{
       link = current->next->next;

       if(current->next!=NULL)
       {
       	tmp->data = current->data;
       	current->next->data = current->data;
       	current->data = tmp->data;

       }
         current = link;
	}
      return head;

}

void cleanlist(Node*head)
{
	while(head!= NULL)
	{
		Node*temp = head;
	    head=head->next;
	    delete temp; 
	}
}

int Main()
{
	int n;
	Node* result = NULL, *first = NULL, *last = NULL;
	cout<<"\n Enter the number of elements in linklist:";
	cin>>n;
	cout<<"\n Enter the elements in linklist";
	for (int i=0; i<n;i++)
	{
		int val;
		cin>>val;

		Node* node = new Node(val);
		if (first = NULL)
		{
			first = node;
			last = node;
		}
		else
		{
			last->next = node;
			last = node;
		}

	}

	result = reverse(first);

	Node * temp;
	temp = result;

	cout<<"\n Reversed linklist is:";
	while (temp!=NULL)
	{
	     cout<<temp->data<<" ";
	     temp = temp->next;
	}

	cleanlist(first);

	return 0;
}
What is the linker error?
Line 52: main is misspelled. main() MUST be lower case.

^^^

thanks.... mann i have started to make horrendous errors..
Topic archived. No new replies allowed.