write a check function for it, then just pass the 2 panels to make it easier
Code:
int panel_istouching(PANEL* pnl1, PANEL* pnl2){
	
	//check left
	if((pnl1.pos_x + pnl1.size_x) < pnl2.pos_x){
		return(0);
	}
	
	//check right
	if((pnl1.pos_x > (pnl2.pos_x + pnl2.size_x)){
		return(0);
	}
	
	//check top
	if((pnl1.pos_y + pnl1.size_y) < pnl2.pos_y){
		return(0);
	}
	
	//check bottom
	if((pnl1.pos_y > (pnl2.pos_y + pnl2.size_y)){
		return(0);
	}
	
	return(1);
}

void panel_move(){
	
//...
	if panel_istouching(pnl_ship, pnl_rock){
		//do something
	}


hope this helps
*untested*