Для начала это объявление узла
struct Node {
int data;
Node* next;
};
недопустимо в C. Вы должны объявить структуру как
struct Node {
int data;
struct Node* next;
};
Ваше определение функции не будет компилироваться и не имеет большого смысла.
Это может быть определено, например, следующим образом
struct Node * make_list( const int values[], size_t n )
{
struct Node *head = NULL;
struct Node **current = &head;
for ( size_t i = 0; i < n; i++ )
{
*current = malloc( sizeof( struct Node ) );
( *current )->data = values[i];
( *current )->next = NULL;
current = &( *current )->next;
}
return head;
}
Вот демонстрационная программа.
#include <stdio.h>
#include <stdlib.h>
struct Node
{
int data;
struct Node* next;
};
struct Node * make_list( const int values[], size_t n )
{
struct Node *head = NULL;
struct Node **current = &head;
for ( size_t i = 0; i < n; i++ )
{
*current = malloc( sizeof( struct Node ) );
( *current )->data = values[i];
( *current )->next = NULL;
current = &( *current )->next;
}
return head;
}
void out( struct Node *head )
{
for ( ; head != NULL; head = head->next )
{
printf( "%d -> ", head->data );
}
puts( "null" );
}
int main(void)
{
int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
const size_t N = sizeof( a ) / sizeof( *a );
struct Node *head = make_list( a, N );
out( head );
return 0;
}
Ее вывод
0 -> 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> 9 -> null