Can I use both clang and gcc compiler in yosemite? I need gcc as a default compiler to compile cuda samples and I need clang to compile my network projects because clang has  better warnings and errors specifications.

Is there any way to run both compilers?
Yes you can.

Apple's Xcode supplies clang (and puts in /usr/bin/gcc a link to clang not gcc)

Then you can then install gcc - probably the easiest way is via a package manager like Macports, Homebrew or Fink