Are call by reference functions of type int or double legal when using an ifstream or ostream argument?

Example:

int afunction(ifstream& in, int anumber)
{
/* Function Body */
}

If this is/isn't legal please explain. Thank you for your help.

-Arielle

Of course its legal -- you just forgot the & symbol after int

int afunction(ifstream& in, int& anumber)
{
/* Function Body */
}

I thought it was "legal" to mix parameter lists.

Also thanks for the quick reply :)

I thought it was "legal" to mix parameter lists.

Yes, you can mix and match as you wish.

Thanks a million!

In fact, fstream parameters must be passed by reference by the current standards. Pass by value should result in a compiler error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.