It's compiling but it's not working, it enters in stack overflow. It's a Doubly Linked List I'm compiling in Visual Studio. I think there's nothing wrong with this declaration, but there's just might be it:
lol, sorry to bother you by the way I name them, and thank you for your reply. The List object happens to be in the ListItem because I need the list reference in case I need to replace the firstItemRef when adding a new list item in the list that makes a comparison with listItem's cpf in case it's lesser than firstItemRef it should replace his position.
int main()
{
int * CPFlist;
List *list[ARRAY_SIZE] = {0} ;
printf("Programa iniciado.\n");
CPFlist = newint[ARRAY_SIZE];
GenerateList(CPFlist, ARRAY_SIZE);
for (int i = 0; i < ARRAY_SIZE; i++)
{
int index = PegaIndice(CPFlist[i]) ;
if ( index >= ARRAY_SIZE )
{
printf( "Illegal index encountered. Terminating program.\n") ;
return 0 ;
}
if (list[index] == NULL)
list[index] = new List();
list[index]->Add(CPFlist[i]);
}
return 0;
}
I've just found out that the problem wasn't actually the circular reference declaration, but rather dynamically variable declaration. All I had to do is move the list variable to global scope.