writes the member functions of objl to fl
writes the data in objl to fl
writes the member functions and me data of objl to fl
writes the address of objl to fl
Answer is Wrong!
Answer is Right!
The correct answer is: B. writes the data in objl to fl
The statement fwrite((char*)&objl, sizeof(objl), 1, fl)
writes the data in the object objl
to the file fl
. The sizeof(objl)
expression gives the size of the object, which is the sum of the sizes of all of its members. The (char*)&objl
expression is a pointer to the first member of objl
. The 1
in the third argument to fwrite
specifies that the object is to be written as a single unit.
The other options are incorrect because:
- Option A is incorrect because the member functions of
objl
are not written to the file. - Option C is incorrect because the member functions and data of
objl
are not written to the file. - Option D is incorrect because the address of
objl
is not written to the file.