Car not starting

When I go to start my car I get this really loud ticking/grinding sound and the engine wont start. This happened to me a few times a week or so ago but then it has been starting fine ever since. Now it is doing it again but wont start. Anyone know what might be wrong with the car? Any help would be appreciated. Thanks
 
Well I got the altenator and battery checked and both are fine. It looks like I might have a bad connection somewhere going to the battery. I disconnected the negative side of the battery and attached it again and the car starts fine.