Function Prototype

This is a discussion on Function Prototype within the C Programming forums, part of the General Programming Boards category; I'm supposed to write a possible function prototype for the following line of code and y is a double: f(&y); ...

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    39

    Function Prototype

    I'm supposed to write a possible function prototype for the following line of code and y is a double:
    f(&y);

    Why would you ever have an "&" right there, and what would the prototype be?

    Thanks

  2. #2
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    Given that '&' is the "address-of" operator:
    Code:
    double x = 0;
    double *x = &x;
    It should be easy to figure out how to change:
    Code:
    double f (double y);
    into what you want.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Best C++ Function Prototype
    By Geometrian in forum C++ Programming
    Replies: 6
    Last Post: 01-21-2011, 09:31 PM
  2. function prototype
    By eurikau in forum C Programming
    Replies: 1
    Last Post: 07-31-2007, 02:19 AM
  3. function prototype
    By shuo in forum C++ Programming
    Replies: 9
    Last Post: 04-19-2007, 10:25 PM
  4. Replies: 13
    Last Post: 08-24-2006, 01:22 AM
  5. Function ... should have prototype ?
    By c-- in forum C Programming
    Replies: 4
    Last Post: 12-27-2001, 10:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21