#include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *next;
};
int main(int data[], int n)
{
struct node * tmp;
struct node * header = 0;
if (data == 0) { printf("error"); return 0; }
while (n-- > 0) {
if (data[n] != n) { printf("error"); return 0; }
tmp = (struct node *)malloc(sizeof(node));
if (tmp == 0) { printf("error"); return 0; }
tmp->data = data[n];
tmp->next = header;
header = tmp;
}
return (int)header;
}