Thread: function definition problem

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    90

    function definition problem

    have a code in 1.c file and the definition is in 1.h file
    example
    1.h
    double option (const double& S, const double& K, const double& r,
    const double& sigma, const double& time) ;

    when i complie the c file iam getting the following erros;
    In file included from 1.c:1:
    1.h:3: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
    1.h:5: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
    may be my problem is with parameters.
    is it right way to declare "const double& S".
    thank u
    sree

  2. #2
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    in the prototypes isn't it mean to be * and not &


    I think

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > is it right way to declare "const double& S".
    C doesn't have references, so either
    - use a C++ compiler
    - recode to use pointers.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. Bisection Method function value at root incorrect
    By mr_glass in forum C Programming
    Replies: 3
    Last Post: 11-10-2005, 09:10 AM
  4. Replies: 6
    Last Post: 03-02-2005, 02:45 AM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM