Array/File FunctionsWrite a function named arrayToFile. The function should accept three arguments:the name of a file, a pointer to an int array, and the size of the array. The functionshould open the specified file in binary mode, write the contents of the array to the file,and then close the file.Write another function named fileToArray. This function should accept three arguments: the name of a file, a pointer to an int array, and the size of the array. Thefunction should open the specified file in binary mode, read its contents into the array,and then close the file.Write a complete program that demonstrates these functions by using the arrayToFilefunction to write an array to a file, and then using the fileToArray function to readthe data from the same file. After the data are read from the file into the array, displaythe array’s contents on the screen.
Array/File Functions
Write a function named arrayToFile. The function should accept three arguments:
the name of a file, a pointer to an int array, and the size of the array. The function
should open the specified file in binary mode, write the contents of the array to the file,
and then close the file.
Write another function named fileToArray. This function should accept three arguments: the name of a file, a pointer to an int array, and the size of the array. The
function should open the specified file in binary mode, read its contents into the array,
and then close the file.
Write a complete program that demonstrates these functions by using the arrayToFile
function to write an array to a file, and then using the fileToArray function to read
the data from the same file. After the data are read from the file into the array, display
the array’s contents on the screen.

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images









