Week 9 Flashcards
There are two main ways the compile views a 2d array, how do they differ?
int a[][] is a cube
int **b is an array with each array item pointing to another array
How many malloc calls do we require to create a 2D array?
Two mallocs
How do you interpret the declaration int ***a?
A 3D array
A pass-by-reference of a 2D array
Given int **a: What data type if a?
A is a 2D array or a pass-by-reference of a 1D array
Given int **a: What is *a?
A pointer to an integer
Given int **a: What is **a?
**a is an integer value
What are the three modes of interacting with files?
Read the contents of a file
Write to a new file
Append to an existing file
Writing and appending operate in a similar manner. What is the main difference?
Where the writing happens.
Write -> start writing at the first byte of the file
Appending -> start writing after the last byte of the file
If the file doesn’t exist when its called, what happens?
The open call fails
What are the four buffers to your program?
Keyboard input
Screen output
disc drive output
network output
Emptying a buffer: What is the input buffer?
Reading the data
Emptying a buffer: What is the output buffer?
Filling the buffer
Printing \n (for the screen only)
Closing the file
Explicitly pushing the data to the file
What is “flushing” the buffer?
Explicitly pushing the data to the file
How are files accessed?
Through a file descriptor
The file descriptor keeps track of all the important file information. What is it?
Where does the file live?
Where am in the file?
What operations are available on the file?
What permissions do I have for the file?