Https://ide.codingblocks.com/s/227648,not getting the desiered output also

source.cpp: In function ‘node* rev(node*&, int)’:
source.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
41 | }
| ^

this error is coming at compile but in sub. all test cases are passing

line 37 to 40

		while(n!=NULL){
			head->next = rev(n,k) ;
			return prev;
		}

has to be
if ( n != NULL ) {
head->next = rev(n , k );
}
return prev;