Well, to list all the subdirectories, you can do something like
ls -RF | grep \/
When you have all the subdir's then you can go through these on an ordinary loop, and list the appropriate files.
Code:
#!/bin/bash
for dir in `ls -RF | grep \/ | tr \: \/` ; do
for file in `ls $dir/*.c` ; do
gcc $file <whatever options>
done
done
Or not
The "tr \: \/" pipe only exchanges the trailing ":" to slashes, to avoid errors.