Unexpected error is occuring, Kindly help to resolve
/*Program to delete the nth Node from the Linked List*/
see the code piece here:
You forgot to add the name of the struct
here:
struct{
int data;
struct Node* next;
};
It should be
struct Node {
int data;
struct Node* next;
};
Another problem is that you use new
which is a C++ operator to allocate memory. In C, use malloc
or calloc
to allocate memory. Don't forget to check is return value to check if was successful in allocating memory.
Also, here
if (temp1 ==1)
You compare a pointer with an int
. This is wrong. I don't know what you are trying to do here...