Thread: function redeclaration gives an error

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Your function definition:
    Code:
    float computedecimal (degrees, minutes, seconds)
    does not match your function prototype:
    Code:
    float computedecimal (int, int, int);
    You should keep the parameter names in the prototype to avoid this kind of mistake.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #2
    Registered User
    Join Date
    Jan 2011
    Posts
    101
    Thanks laserlight.

    I changed the prototype to
    Code:
    float computedecimal (degrees, minutes, seconds);
    But now get 2 errors :
    error : expression list treated as compund expression in initializer [f-permissive]
    and
    'computedecimal' cannot be used as a function

    Did I understand you correctly when I changed the initial declaration?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error "in function 'main' syntax error before 'int' Help Please
    By blackhat11907 in forum C Programming
    Replies: 5
    Last Post: 08-20-2011, 07:05 PM
  2. enum redeclaration
    By mynickmynick in forum C Programming
    Replies: 4
    Last Post: 02-26-2009, 12:06 PM
  3. redeclaration of enumerator
    By dlittle in forum C Programming
    Replies: 4
    Last Post: 01-13-2009, 11:35 AM
  4. string redeclaration in function, why is required?
    By elninio in forum C++ Programming
    Replies: 6
    Last Post: 07-14-2008, 06:58 PM
  5. Redeclaration Error
    By shiju in forum C Programming
    Replies: 6
    Last Post: 09-02-2004, 07:51 AM