How to exclude file when using scp command recursively

Originally published at: https://www.cyberciti.biz/faq/scp-exclude-files-when-using-command-recursively-on-unix-linux/

I need to copy all the *.c files from local laptop named hostA to hostB including all directories. I am using the following scp command but do not know how to exclude specific files (such as *.out):
$ scp -r ~/projects/ user@hostB:/home/delta/projects/
How do I tell scp command to exclude particular file or directory at the Linux/Unix command line?