For instance I play D in the bass on piano and C,E,G in the right hand. Is it a D/C chord or a Cadd9 with D in the bass?
You mean a C/D i think?
The chances are it's C/D. A common dominant- or pre-dominant-function chord in G major. It can get to G via D7, or go straight to G - a typical 'gospel' effect. (What it ISN'T is D7sus or D11, though you have to be prepared to see it labelled as such.)
But without seeing the context, we can't tell for sure what its harmonic function is. And it can be useful to label chords differently according to what they DO.
Most of the chord is C major (CEG) so it'll be written with C first. The D note in the bass makes the name C/D. Cadd9 is usually stated when the D is in fact the 9th note (or root>9), so the D is above the triad rather than below.
It could just about be construed as D11, which should contain D, F#, A, C, E, G, but sometimes has 7th and 4th, so - D, F#, (A), C and G, but here with no maj 3 it's hardly going to be so. Especially not when the key is C, F or G.
The notes as you've described of RH=CEG, LH=D make a lot of sense as a chord appearing C/D. Other musicians would see this and readily understand it very similarly to how you worded it, i.e., "a C chord with a D in the bass."
If you were to write a lead sheet with this and hand it to other musicians in a band, the bass player would know his note is D. Other chord instruments like guitar can play the C chord.
Many times chords are written this way because they're more readable. You could write it with the root as a kind of D11, yet you'd then have to indicate to leave out the 3rd and the 5th if you want to guarantee nobody plays them. (Roughly analogous saying C/D is like ordering a
"Big Mac with onions only" vs. a
"Big Mac without special sauce, lettuce, cheese and pickles.")
It also depends on the kind of music being played. You'll see C/D in rock and pop sheet music. People who play those styles would readily recognize it, esp. when you hand them a lead sheet and they're ready to perform without practicing.