Is there a way for a C program to determine whether its output to stdout is being redirected?

(I would like to be able to display to stderr more warning messages if it is redirected than if not).