CS 159 Lab 12
A pointer is a variable that stores an address as its value
T
A user-defined function may be declared to return a pointer value
T
All of the memory management functions are found in the standard library (stdlib.h).
T
Dynamic memory allocation uses predefined functions to allocate memory for data while the program is running.
T
Every time we want a called function to access a variable in the calling function we pass the address of that variable to the called function
T
If we need to know the size of any data type the sizeof operator will give us the exact size in bytes.
T
Static memory allocation requires that the declaration and definition of the memory be fully specified in the source program.
T
The C programming language provides two options for requesting memory, static allocation and dynamic allocation.
T
The act of dereferencing a pointer variable permits access to the value at the memory location to which the pointer variable points (or refers).
T
The asterisk character (*) is used in two different contexts for pointer variables; for declaration and for dereferencing.
T
The dereference of an array name is the value of its first element.
T
The following code segment uses pointer arithmetic to access and display the contents of the array. int i; int a[5] = {1, 3, 5, 2, 4}; for(i = 0; i < 5; i++) { printf("%d ", *(a + i)); } printf("\n");
T
The following expressions are identical for the array a and integer n: (a + n) and &a[n]
T
The following expressions are identical for the array a and integer n: *(a + n) and a[n]
T
The indirection and address operators are the inverse of each other and when combined in an expression they cancel each other.
T
The indirection operator (*) is a unary operator whose operand must be a pointer value.
T
The malloc function allocates a block of memory that contains the number of bytes specified in its parameter
T
The malloc function returns the starting address of the memory allocated.
T
The memory allocated as a result of the malloc function is not initialized and we should assume that it will contain unknown values
T
The name of an array is a pointer constant to its first element.
T
The name of an integer array can be assigned to an integer pointer variable.
T
The proper initialization of a pointer variable will include an address on the right side of the assignment operator with the pointer variable on the left
T
The result of the malloc function is assigned to a pointer variable.
T
The size of an element is determined by the type of the pointer.
T
The value of a pointer variable can change during the execution of a program.
T
When a whole array is passed to a function the called function can declare the array using the traditional indexing notation [ ] or as a simple pointer variable
T
When adding an integer to the name of an array the result is a value that corresponds to another index location.
T
Working with an uninitialized pointer variable is a logical error.
T