Regret but this is completely wrong application of pointers. Just, separate two functions - write and read in two different source files and see for yourself.