Thread: Error Messages

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    3

    Error Messages

    The software I use doesn't tell me the meaning of the error messages when I compile the source code.
    One error message that I dont understand is:

    Error: Function has no prototype

    What does this mean?
    (does it mean it is not declared?)

    thnx

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Yes. When function A uses function B then function B should be declared before function A or a prototype of function B should appear before function A.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    247
    hI,
    you have either forgot to use the #include header file for the function OR have forgot to print your own prototype in your program.

    Code:
    int add (int x, int y); /*this is the prototype for function add*/
    
    int main ()
    {
       int a = 10, b = 15, answer = 0;
    
       answer = add(a, b);
       printf("This printf doesnot work until I #include <stdio.h>");
       return 0;
    }
    
     int add (int *x, int *y)
    {
        return (x + y);
    }
    hoping to be certified (programming in c)
    here's the news - I'm officially certified.

Popular pages Recent additions subscribe to a feed