You just need to pass in a pointer to the pointer:
Code:
void shift_to_next( struct test **file, struct test *start_of_list_file )
{
if( (*file)->next == NULL ) *file = start_of_list_file;
else *file = (*file)->next;
}
And then call the function like this:
Code:
shift_to_next( &tmp, start );
Of course, another way would be to just make shift_to_next() return the new pointer. Then you could just have this:
Code:
struct test *shift_to_next( struct test **file, struct test *start_of_list_file )
{
return file->next == NULL ? start_of_list_file : file->next;
}
Code:
tmp = shift_to_next( tmp, start );