What is the meaning of

This is a discussion on What is the meaning of within the C++ Programming forums, part of the General Programming Boards category; What is the meaning of the & in the function? Code: void affine(int a, int b, ifstream& input, ofstream& output) ...

  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
    21,628
    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*
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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
    21,628
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,543
    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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,543
    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, 03: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, 08:22 PM

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