It's true. You can build games using C. But you can build better using C++.
Object oriented design helps a lot when you model the game world, entities
and entity interactions. Plus, there are very good libraries available to help.
As for your code request, I guess there are a couple of things I can give you...
The first was my first attempt to write a console based snake game. I attach the cpp file.
Or, if you want a comprehensive guide, try "The C Programming Language" by Dennis Ritchie and Brian Kernighan. Dennis Ritchie was one of the original developers of C, the other being Ken Thompson (credited because he invented B -- the predecessor of C).