As mentioned in the comments, you increment the loop variable twice.
Why not simply print the stack in its entirety instead of only 5 elements?
void print_path(void)
{
int j;
for(j = 0; j <= tp; j++)
{
printf("%d ", path[j]);
}
printf("\n");
}