Have you tried restarting your iPhone? Press and hold both the power and home buttons until the Apple logo appears, then release both buttons and wait for the iPhone to restart.
It's possible that the camera has become defective. Do you live close enough to an Apple Store to take the iPhone in for a Genius Bar appointment to have a diagnostic check done? This would confirm whether or not you have a hardware problem.
Genius Bar appointments at the Apple Store are always free. If the problem is software related, the fix is usually free as well. If there is a hardware issue, they'll tell you exactly what's wrong and what the repair cost will be. If there is a hardware problem, you may want to consider updating to a newer iPhone as the iPhone 4 is as much as 4 years old by now.