Poniżej wstawiam kod. Program sie kompiluje. Ale przy wywołaniu pliku a.out wyskakuje błąd fregmentation fault (core dumped). Doczytałem, że problem jest ze niewłaściwym wskaźnikiem ale nie mam pojecia gdzie. Z góry dzięki za pomoc.
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include "funkcje.hpp"
using namespace std;
lista *head;
void tworzenielisty(int n)
{
head = NULL;
int *nowa = new int[n];
for (int t=0;t<n;n++)
{
nowa[t]=(rand() % (10*n) + (n*n));
}
for (int g=0;g<n;g++)
{
lista * p = new lista;
if (head==NULL)
{
p->data=nowa[g];
p->next=NULL;
head=p;
cout<<"yolo";
}
else
{
p->data = nowa[g];
p->next = head;
head = p;
}
}
}
void wyswietlenielisty()
{
lista *t;
t=head;
while(t->next!=NULL)
{
cout<<t->data;
t=t->next;
}
}