Ping from C code

What is the easiest way (i.e. fewest number of lines) to verify if a certain
IP address is accessable?

This is kind of like a ping from a C routine, HOWEVER, it does not have to
be a ping. If there is a cheaper way to confirm accessability, that will do

But, here’s the wrinkle. It’s actually the return path that is in doubt.
This is an embedded system behind an embedded system. I know that my route
out is correct. I want to detect if the remote host has a route back to me.