Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
17 Cards in this Set
- Front
- Back
How do you declare a function pointer as a parameter?
|
retType (*paramName)(args)
|
|
What is the function signature of calloc?
|
void* calloc(size_t numOfElements, size_t sizeOfAnElement)
|
|
How would you declare a template function named "func" that takes a parameter of type "T"
|
template <class T>
void func(T param); |
|
How do you express a 2-dimensional int array of 5 rows and 3 columns in C?
|
int a[5][3]
|
|
Given a 2 dimensional int array of 5 rows and 3 columns, how do you get the value in the second row, first column?
|
a[1][0]
|
|
Is there a difference between passing a pointer to an array (e.g. int*) versus a declaration of an array (e.g. int[]) as a function parameter?
|
No; both will be used as reference semantics to the function.
|
|
When defining a multidimensional array as a parameter to a function, why must all but the first dimension be specified? (e.g int a[][2])?
|
In order to perform pointer arithmetic on the first dimension, the size of the subsequent dimensions must be known.
|
|
What is the function signature of malloc?
|
void* malloc(size_t size)
|
|
What is the function signature of free?
|
void free(void* ptr)
|
|
What is the function signature of realloc?
|
void* realloc(void* ptr, size_t size)
|
|
Define a functor object that implements a predicate for a const int&
|
class pred
{ public: bool operator()(const int& i); }; |
|
What is the function signature of memcpy?
|
void *memcpy( void* dest, const void* src, size_t count );
|
|
What is the function signature of memmove?
|
void *memmove( void *dest, const void *src, size_t count );
|
|
What's the difference between memmove and memcpy?
|
If some regions of the source area and the destination overlap, memmove ensures that the original source bytes in the overlapping region are copied before being overwritten...memcpy does not.
|
|
What is the function signature of memset?
|
void *memset( void *dest, int c, size_t count );
|
|
What the signature of strtok_s?
|
char* strtok_s(char* str, const chart* delim, char** context);
|
|
How do you use strtok_s?
|
To get the initial token, you pass a string that contains tokens, a string that contains delimiters, and a context char* (used to track the current postion between calls). To get the remaining tokens, pass NULL as the first parameter.
Leading delimiters are not included in the return value. strtok_s returns NULL when there are no more tokens |