COMP1850 Lecture 8.1 Data Structures in C

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

1/11

flashcard set

Earn XP

Description and Tags

Flashcards covering key concepts related to structures in C, including definition, usage, and relationship to Object-Oriented Programming.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

12 Terms

1
New cards

Structures in C

Grouping related data under a single name.

2
New cards

Structures as collections of data

Collect related data into a single, meaningful structure; allows us to model problems in terms of problem-specific data types.

3
New cards

Bank account data structure

Name, account number, branch sort code, and balance.

4
New cards

Student data structure

Name, student ID number, school, and degree subject.

5
New cards

Single Responsibility Principle (SRP) in structure design

Structures should encapsulate a meaningful unit of data and be named accordingly; larger structures can be composed from other structures.

6
New cards

typedef

Defines a new data type based on a structure, allowing its use without the 'struct' keyword.

7
New cards

'.'

Access to structure fields using the variable.

8
New cards

'->'

Access to pointer-to-structure fields via the pointer.

9
New cards

Pass by value vs. Pass by reference

Pass by value creates a copy, safer but uses more memory; pass by reference modifies the original, more efficient for large structures.

10
New cards

Self-referential structure

The structure contains a pointer to its own type, commonly used in linked lists, trees, and graphs.

11
New cards

Data abstraction with C structures

Group related data into logical units; model real-world entities.

12
New cards

Structure Design Mirrors OO Design

Identify key attributes and behaviors, determine relationships, create appropriate interfaces (functions).