Trying to make my function that takes in an array and arrayLength and outputs a linked list equivalent to the array.Any help would be greatly appreciated!
Node* array2List(int A[], int n)
{
Node* p;
Node* q;
q = NULL;
for(int i = 0;i<n;i++)
{
p = new Node;
p->val = A[i];setcar(p,A[i]);
cout << p->val;//just to check if p->val is getting the right values, and it is.
p->link = q;
q = p;
}
return reverse(p);
}