C/for prototype error
Expert: Zlatko - 9/28/2010
QuestionDear Sir
i write a program in c language and if run it i get prototype error. how i solve the error
AnswerAre you sure you are getting the error when running, and not when compiling ?
If you are getting the error while compiling, it is because you need to add a declaration for some function that you are using. For example, if in some file you have a function like this:
void myFunction(int someParameter)
{
}
and from another file you call myFunction, then in the file where myFunction is being called, you need to include a declaration for myFunction, like this:
void myFunction(int someParameter);
This declaration is also called a prototype. Notice the semi-colon at the end, and notice there is no function body.
Usually what we do is create a header file with all the prototypes, and then include the header file into all our project files.
Send me the complete error message, and a copy of your program, and I will try to help you more.
Best regards
Zlatko