Я пытаюсь создать связанный список и до сих пор продолжаю сталкиваться с ошибкой сегментации.
Через некоторое тестирование мне удалось выяснить, где это происходит, но я не уверен, почему это происходит.
Это срабатывает на линии: tempo->fileName = str;
Это из-замне пытаться назначить указатель или это что-то еще, о чем я не знаю?
typedef struct listnode{
struct listnode* next;
char* fileName;
} listnode;
struct listnode* head;
//This section of code will be dedicated to the creation and management
//of the listnode functions
listnode* createNode(char* str, listnode* next){
listnode* tempo;
tempo = (listnode*)malloc(sizeof(struct listnode));
if(tempo = NULL){
printf("Error creating space for new node.\n");
exit(0);
}
tempo->fileName = str;
tempo->next = next;
return tempo;
}