CMPSC 311 – Pointers, Arrays, and Function Pointers

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/14

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering key terms from the lecture on pointers, arrays, command-line arguments, and function pointers.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

Row-Major Order

The memory layout used by C in which consecutive elements of a row of a multidimensional array are stored contiguously.

2
New cards

Multidimensional Array Declaration

In C, all dimensions except the first must have explicit bounds (e.g., int x[][4] is valid, but int x[][] is not).

3
New cards

Array Decay

The automatic conversion of an array name to a pointer to its first element when passed to functions or used in expressions.

4
New cards

Array of Strings (Fixed-Width)

A declaration such as char planets[][8] where each string occupies a fixed number of bytes in a 2-D char array.

5
New cards

Array of Pointers to Strings

A declaration like char *planets[] in which each element is a pointer to a separately stored null-terminated string.

6
New cards

Pointer Arithmetic on String Arrays

Iterating with char **p = planets; p < planets+8; ++p lets you traverse an array of string pointers using address arithmetic.

7
New cards

argc

An int parameter to main indicating the number of command-line arguments, including the program name.

8
New cards

argv

An array of char pointers passed to main that stores each command-line argument as a null-terminated string.

9
New cards

Double Pointer (int **, char **, etc.)

A variable that stores the address of another pointer, enabling modification of the pointer itself inside functions.

10
New cards

swapception

An example function void swapception(int **xp, int **yp) that swaps two pointer variables using double pointers.

11
New cards

Triple Pointer

A pointer to a double pointer (e.g., char ***cpp) often used for complex data structures or indirection chains.

12
New cards

Function Pointer Syntax

void (*func_ptr)(int,int) declares a pointer to a function taking two ints and returning void.

13
New cards

Calling via Function Pointer

Using (*funcptr)(10,5) (or funcptr(10,5)) to invoke the function to which the pointer currently refers.

14
New cards

qsort

Standard library function void qsort(void base,sizet nmemb,sizet size,int(compar)(const void,const void)) that sorts an array using a user-supplied comparison function.

15
New cards

Comparator Function

A function like int cmpfunc(const void *a,const void *b) passed to qsort that returns negative, zero, or positive to indicate ordering between two elements.