Question
What type cast do you use to convert a pointer from one type to another?
Solution
VerifiedAnswered 1 year ago
Answered 1 year ago
Step 1
1 of 2When working with binary files, we must use functions read() and write() to get the data from a file or store it in the file.
Both of these functions take a char pointer/address as the first argument, which specifies either the string to be written or a char array to which the read data will be stored.
However, we might want to read or write data of some other type except char to the file. In that case, we must cast the said data type pointer to the char pointer. This is done using the reinterpret_cast, which is used whenever we need to convert a pointer from one type to another.
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
More related questions
1/4
1/7