declaration terminated incorrectly... what could be the problem?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alexa Author
    New Member
    • Aug 2011
    • 1

    declaration terminated incorrectly... what could be the problem?

    Hi! I'm new in turbo C... and I'm trying to make a Program to calculate the product of two numbers.
    please help me! I'm using Turbo C v3.0

    this error occured:
    25:Declaration terminated incorrectly

    Code:
    #include<stdio.h> 
                                                                
    int a, b, c;                                                                 
    int product (int x, int y);                                                   
                                                                                
    main()                                                                        
    {                                                                            
    //input first number                                                          
    printf("enter a number between 1 and 100: ");                               
    scanf("%d", &a);                                                                                                              
                       
    //input second number                                                         
    printf("enter another number between 1 and 100: ");                           
    scanf("%d", &b);                                                              
                                                                                 
    c = product(a, b);                                                            
                                                                                
    printf ("%d times %d = %d\n", a, b, c);                                   
                                                                                 
    return 0;
    }                                                        
                         
    int product( int x, int y);                                                   
                                                                                  
    {                                                                             
    return (x * y);                                                               
    }
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Remove the semicolon in the function declaration.

    Comment

    Working...