The progrm runs then when I enter a number this comes up in a error message then my program close
The variable is being used without being initialized c
this is the code
The progrm runs then when I enter a number this comes up in a error message then my program close
The variable is being used without being initialized c
this is the code
Last edited by bob_999; 01-08-2011 at 06:28 PM.
If you're using gets, you've already lost. In this case, not only are you using gets, but you are using it incorrectly (the parameter passed to it is supposed to be a char*, not an int, and surely needs to point at actual memory (hint: 00 is not actual memory)).
EDIT: I suppose I should be very clear about this: take any use of gets right out of your program. You can use fgets, or scanf, as you wish.
basically reads in data from the user and writes it - using the unsafest function you could have found for reading a string, gets() - to a NULL pointer. That is a crash waiting to happen.Code:int SearchName = 00; gets(SearchName);
If you are getting complaints from your compiler, address them first. But, basically, in current form, your code is rubbish.
its now said Error 15 error C2198: 'fgets' : too few arguments for call c:\documents and settings\stevie\desktop\project65\project65\gympro ject2\gymproject2\gymproject2\gymproject2.c 239
fgets takes more arguments than gets. Try google.
C is fun
Hi Bob... Mind if I chip in just a little bit of advice here?
In your place I would post the problem code, clearly highlighting the parts that are producing errors, and explaining what you've already done to try and fix it...
The hassle you're getting seems more related to how you are asking the question than anything else... (loony BASIC examples, aside).
Before he edited the original post to remove the code, that code contained no variable named c, initialised or not. It therefore had absolutely no relevance to the problem described.
When someone can't be bothered applying the effort to ask a meaningful question, they tend to get static.