I've tried everything, line 59 has this error from title.
There is .dat file I have to sort from .dat and print in .exe.
When compiling it says it cannot convert. what could it be?
I've only included the problematic function and the main code.
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node * next;
} node_t;
struct node push(node_t * head, int val)
{
node_t * current = head;
while (current->next != NULL)
{
current = current->next;
}
current->next = (struct node *)malloc(sizeof(node_t));
current->next->value = val;
current->next->next = NULL;
return current;
}
int main() {
node_t * list = (struct node *)malloc(sizeof(node_t));
FILE* file = fopen ("kol1.dat", "r");
int i = 0;
do
{
fscanf (file, "%d", &i);
list = push(list, i);
list = sort_list(list);
print_list(list);
}while (!feof (file));
fclose (file);
return 0;
}