You're probably accessing memory outside the bounds of an array or which you didn't allocate. As such, you triggered undefined behaviour, so pretty much anything can happen, including crashing or even apparently working fine.
my c code crashes when running it on c-free but works fine on borland?
-
04-12-2021 - |
Pergunta
when running my code in borland c 3.1 it works fine, but when running it on c-free it crashes at this line: while(ptr1->pright)
{
ptr1=ptr1->pright;
}
giving SIGSEGV, any logical reasons?
Solução
Outras dicas
When creating/initialising your linked list's nodes make sure to explicitly initialise the node's member pright
to NULL
.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow