Enter Password in C
The function that you are looking for is: getpass(). You will note, though, that it is marked as "LEGACY". Although it isn't going to go anywhere, the function doesn't allow the size of the input buffer to be specified, which makes it not a very good interface. As Jefromi has noted, the glibc manual provides portable example code for implementing getpass from scratch in a way that allows an arbitrary input size (and isn't LEGACY).
sudo is written in C, so yes :). The getpass()
function Safyan mentioned is probably what you want, but here's where the actual sudo tool does it if you're interested:
http://sudo.ws/repos/sudo/file/dc3bf870f91b/src/tgetpass.c#l70