Is this the correct syntax for passing a file pointer by reference?
Function call: printNew(&fpt);
printNew(FILE **fpt)
{
//change to fpt in here kept after function exits?
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. The correct syntax is
Your code will only change the local pointer to a FILE pointer. Only changes to
*fptare seen by the caller in your code. If you change it to the above, things are passed by reference and changes are promoted like intended. The corresponding argument is passed as usual