AMT2K5 wrote:
> "FILE* setFp(char []) - setFp is passed a null terminated character
> array that contains the name of a file. Before attempting to open the
> file check the state of fp. If fp is not null close fp. Open the file
> in read mode using fp. Return fp."
>
> In my assignment it wants the setFP function to take in a nameless
> parameter? I am used to seeing something like "char a[]", not just an
> empty variable name. How do I act on the incoming string if it has no
> name?
I think you're looking too much into the details of the assignment.
Function declarations do not need argument names, only the types. So,
whoever wrote that assignment decided to omit the name for your own
benefit: so you could name it as you wish. If you think you need to
use that argument, you will have to call it something. If you want it
to be 'a', use 'a'. If you want your code to be self-documenting, do
not use single-letter variable names.
> class Bank
> {
> FILE* fp;
> }
>
> FILE* Bank::setFP(char [])
> {
> //some code goes here
> }
>
V
|