Changed from C++ to C syntax
Compiles with gcc and -Wall