You are here:

C/for prototype error

Advertisement


Question
Dear Sir
i write a program in c language and if run it i get prototype error. how i solve the error

Answer
Are 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

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2012 About.com, a part of The New York Times Company. All rights reserved.