Opens char *filename in binary read mode
Where the address of things change every time a program executes
What is Address Space Randomization Layout or ASLR?
This is a postfix traversal of a tree.
What is LRN?
This is a function you want to use to prevent buffer overflows.
What is strncpy()?
(BONUS 100 for anyone if can provide other functions with justification as to how it prevents buffer overflows)
This gdb command prints out the call stack
What is bt?
access() is used for this.
What function tells you whether the calling process can access the file path?
This grows in the direction of increasing addresses.
What is the heap?
These are two things that must be in a struct for a doubly-linked list to be possible.
What is the previous pointer and the next pointer?
This is a string that cannot change and allocates a pointer on the stack. It's defined as: char *str = "Hello!";
What is a string literal?
(BONUS 100 points: Where is the string array stored?)
This is static but with local variables
What is the storage class where, if utilized, the data is initialized only once and retains its value between invocations of the function?
Moves your file pointer fp in the file to 10 characters before the end
What is fseek(fp, -10, SEEK_END)?
This is the difference between little endian and big endian.
Little endian: least-significant byte stored first
Big endian: most significant byte stored first
This is used to print the address of where the pointer is pointing to
%p
If this does not exist in the string, strcpy and strcmp will fail
What is a null terminator?
This is the full function header for the function that copies everything from the source SDL_Surface to the destination SDL_Surface
int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) ?
This is used with fprintf so that fprintf operates exactly how printf operates.
stdout
I want to access arr[i][j], but arr was defined as a 1d array. How do you access arr[i][j] without ever using brackets?
*((*(arr+i)) + j)
When conducting pointer arithmetic, pointers move based on this.
What is the size of the variable that the pointer is pointing to?
What is incorrect about this code:
char *copy_over(char *msg) {
char *dest = calloc(20*sizeof(char)); assert(dest);
strncpy(dest, msg, strlen(msg));
printf("Success\n"); return dest; }
Strncpy should use the length of dest, NOT the length of msg
This flag tries to "register" variables, compares multiple lines for optimization
-O, -O1
char word[10]; int count; float value;
int ret = scanf(/* format string */, word, &count, &value);
This format string ensures that ret will equal 3 after reading any of the following lines:
mich)ael /42:3.14
#offi_e* /7:0.5
Scott#( /100:25.0
What is "%9[^/]/%d:%f"?
This is the size of the following struct:
struct paper {int count; double price; char type; struct paper* next;}
What is 32 bytes?
(BONUS 100: Can you make the size smaller? If so, what would the smaller size be?)
This is a pointer to a function that accepts 2 integers and returns an integer, and is initialized to NULL.
What is
int (*ptr_to_func)(int,int) = NULL; ?
This is what ret equals when the following function is called.
int ret = strcmp("DunderMifflen", "paperCompany");
-1
Mode in which core components of operating system run, providing them with unrestricted access to all hardware and system resources
What is kernel mode?