What is a pointer? - ANSWERS-A variable that contains the address of
another variable. Used as output parameters which send back results
from functions.
Distinguish between output and input parameters - ANSWERS-output:
to allow the function to return multiple variables. Are pointers put into a
function to return more than one variable.
Input: something that is put into a function for use inside the function.
Declare and apply pointers - ANSWERS-int function(int *A101, double
A102, char *A103)
{
printf(" %d, %lf, %c ", A101, A102, A103);
}
int *ptr - ANSWERS-indicates the declaration of a pointer
*result = i + j - ANSWERS-indicates the dereference operator meaning
"follow the pointer".
END OF
PAGE
1
, CPTS 121 EXAM 2 LATEST
Define what is a direct value - ANSWERS-the values stored in it's
memory
Define what is a indirect value - ANSWERS-the contents of the address
that is being pointer too. Accessed via the dereference operator -
meaning "follow the pointer".
Integer types in C - ANSWERS-int: a whole number. No precision
unsigned int: much larger whole number
Do not use floating point values for Loops - ANSWERS-When you try
and increment large floating point values it may change that value within
the available
precision
Enumerated types in C - ANSWERS-a User defined data type, used to
assign names to integral constants. I.e enum week{Mon , Tue, Wed,
Thurs, Fri, Sat, Sun} and enum week day;
Array - ANSWERS-A collection of contigious or adjacent memory cells
associated with one variable name and type
END OF
PAGE
2
, CPTS 121 EXAM 2 LATEST
Index - ANSWERS-The point memory in an array
declaring Single arrays - ANSWERS-int arr[] = { 0 }
Declaring a 2D Array - ANSWERS-int arr[row][column] = { {NULL}
};
function that accepts arrays - ANSWERS-void arr_func(int arr[]);
function that accepts 2d arrays - ANSWERS-void 2d_arr_func(int
arr[][]);
Arrays passed into function - ANSWERS-Only the the 0th element is
passed, only, is passed into the function.
Pointer and Array interchangeability - ANSWERS-Pointer notation may
always be used with arrays, but array notation may replace pointer
notation only if the pointer points to the start of the array.
END OF
PAGE
3