Thread: What is the meaning of

  1. #1
    Registered User
    Join Date
    Oct 2012
    Location
    Forest Hill, Maryland, United States
    Posts
    39

    What is the meaning of

    What is the meaning of the & in the function?

    Code:
    void affine(int a, int b, ifstream& input, ofstream& output)

    THANKS

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    It means that you are looking at C++ code instead of C code

    And as C++, it means that the parameter is a reference parameter. For more information, you should read/work through an introductory book on C++.

    *moved to C++ programming forum*
    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

  3. #3
    Registered User
    Join Date
    Oct 2012
    Location
    Forest Hill, Maryland, United States
    Posts
    39
    Is there an operator in C that does the same thing?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Is there an operator in C that does the same thing?
    It is not an operator in the first place. It is syntax, similiar to say, the syntax used to declare pointers. Now, there is no equivalent in C, but using a pointer parameter would be a similiar option in C.
    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

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Pointers may be used to achieve the same desired effect, but they are not the same.
    Also, ifstream and ofstream are C++ classes for I/O.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Oct 2012
    Location
    Forest Hill, Maryland, United States
    Posts
    39
    I decided to use FILE* to get the job done

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    What language are you actually intend to learn/use?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. *ptr = 0 what is the meaning
    By dayalsoap in forum C Programming
    Replies: 12
    Last Post: 09-18-2010, 02:49 PM
  2. The meaning of ;
    By HunterCS in forum C++ Programming
    Replies: 7
    Last Post: 07-03-2007, 04:29 PM
  3. Meaning of %hd
    By SeekerOfWisdom in forum C Programming
    Replies: 1
    Last Post: 01-26-2006, 04:18 PM
  4. meaning!!
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 07-22-2002, 07:52 PM
  5. meaning
    By xlordt in forum C Programming
    Replies: 6
    Last Post: 04-01-2002, 09:22 PM