Haviing sgmentation fault error

not running if there are odd nodes in list

hello @kartik-malik
image

interchange position of these two conditions.
i.e first check fast!=NULL and then fast->next!=NULL

1 Like

thanks working now but what was the error

condition get checked from left to right.
so obviously we should first check fast!=NULL and then only fast->next!=NULL.

if we first check fast->next then it might happen that fast is NULL so in that case NULL->next will give error .

that is why we first check whether fast is null of not and then only jump to next conditon

if it returns array then it will check for fast and condition should become false is it not the case?

so it is giving segemtaion fault at null->next is that the case?

that was typo . . . . . . . . :rofl::rofl:

1 Like

yeah correcct . . . . . . . .