There are lots of things that make this non-trivial:
1. Comment characters can appear inside strings.
2. Strings themselves can contain \" making their end harder to detect than you might think.
printf("//I am not a comment!");
3. /*/ can be either the start or the end of a comment block.
printf("Well, \"I am not // a comment either\"");
4. Removing /* */ style comments can screw up code that uses them as the only separator between two other symbols. In fact you won't even necesarily get a compile error. Contrived example
Add or remove the first slash on the next line and change an addition into a multiply.
a = b + c;
a = b * c;
Bottom line, doing this completely correctly requires a basic parser, not just a search and replace mechanism. It doesn't need to be as complex as a C compiler though.
#define a 1
#define b +2
#define ab 12
int x = a/*careful taking me out!*/b;
The real question though is, why would you write such a thing? Surely comments are an asset?