If you want to run C/C++ code in your mac, all you need to do is download the Xcode from apple.  It is free to download. The xcode IDE is pretty good and comes with C/C++ compiler.  You can download here: developer.apple.com/xcode/.?

xcode

Once you have downloaded, select command line project then C or C++ file.  Press Cmd+R to Run and see the output at the bottom right of the editor. If want want a fancy editor for c/c++, go ahead and use free ide like Eclipse.

www.eclipse.org/downloads/