Data Structures in C - Multi-dimensional Arrays, Structs, and Unions

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/7

flashcard set

Earn XP

Description and Tags

This set of vocabulary flashcards covers advanced C data structures including memory reallocation, multi-dimensional array management, structs, unions, and custom vector implementation.

Last updated 4:42 PM on 5/10/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

8 Terms

1
New cards

realloc

A function with the signature voidrealloc(voidoldptr,unsignedintsize)void* realloc(void* old_ptr, unsigned int size) that allocates new memory on the heap, copies data from the old pointer to the new memory, and then frees the old pointer; if oldptrold_ptr is null, it behaves like malloc.

2
New cards

struct

A mechanism for packing multiple variables of different types into a single fixed-size block known at compile time, treating them as a single data structure rather than an object. Can use sizeof(struct MyStruct) to determine byte size.

<p>A mechanism for packing multiple variables of different types into a single fixed-size block known at compile time, treating them as a single data structure rather than an object. Can use sizeof(struct MyStruct) to determine byte size.</p>
3
New cards

Dot syntax

The syntax used to access member variables within a C struct instance, for example, x.a=5x.a = 5.

<p>The syntax used to access member variables within a C struct instance, for example, $$x.a = 5$$.</p>
4
New cards

Arrow syntax

A shortcut in C that is equivalent to dereferencing a pointer and accessing a member variable of a struct at the same time.

<p>A shortcut in C that is equivalent to dereferencing a pointer and accessing a member variable of a struct at the same time.</p>
5
New cards

Words

Blocks of bytes that processors use to access memory; structs are often padded to align with this system word size for efficiency.

6
New cards

pragma pack(n)

A compiler directive used to change the alignment of data by adjusting the padding of internal struct members to nn-byte boundaries.

7
New cards

Union

A data container that can store a single item of one or more possible types, with its total size determined by the size of its largest member.

<p>A data container that can store a single item of one or more possible types, with its total size determined by the size of its largest member. </p>
8
New cards

typedef

A keyword that allows the creation of an alias for custom types, often used to refer to structs without the prefix keyword 'struct'.