how to differentiate variable read and write

Hi,
I want to differentiate variable references read and written
For example:
int i;

x = i; ( here i is read while x is written)

i = 10; ( here i is written)

every variable reference can be caught by DeclRefExpr but how to decide modified variables in the statement?