· 3 min read

Memorize C Pointers, Memory and Syntax: 75 Flashcards on malloc, Dangling Pointers and Undefined Behavior

Master C memory with 75 Flip It flashcards: pointers, malloc and free, array decay, dangling pointers, const char* vs char* const and undefined behavior.

Flat vector illustration of a glowing arrow linking two memory boxes, one empty with a padlock and chained blocks, surrounded by floating flashcards

Studying. But it's also a video game. 🎮

Flashcards, quizzes and games that make you actually remember.

Start playing — it's free

Posted by

Most C decks teach syntax. Deck AW7614 spends its 75 cards on the part that actually breaks programs: what a pointer holds, who owns the memory, and which perfectly compilable line is undefined behaviour. If you can already write a for-loop but still hesitate before free(), this is the deck.

Study this deck: C: Pointers, Memory & Syntax

1 / 10
Question

What was C originally developed for?

Knew itLearning

Tap the card for the answer · swipe right if you knew it, left if not

How the 75 cards are laid out

Cards 1-4 are spec-sheet trivia (successor to B, multi-paradigm, "static, weak, manifest, nominal" typing). Cards 5-20 are the core: pointers, &, NULL, malloc/calloc/realloc/free, leaks, dangling pointers, array decay. Cards 21-31 cover aggregates and the entry point, 32-49 the preprocessor and the qualifiers, 50-61 control flow and undefined behaviour, 62-75 the standard library and null-terminated strings.

FrontBack
Relationship between arrays and pointersArray name decays to a pointer to its first element; arr[i] is equivalent to *(arr + i)
Pointer arithmeticAdding/subtracting integers to/from pointers moves them by that many elements (not bytes)
Dangling pointerA pointer that points to memory that has been freed or is no longer valid
malloc vs callocmalloc allocates uninitialized memory; calloc allocates and initializes memory to zero
Const char* vs char* constconst char* = pointer to constant char (can't modify data); char* const = constant pointer (can't change address)
Volatile keywordTells compiler the variable may change unexpectedly (e.g., by hardware, interrupts)
What happens without break in a switch case?Fall-through - execution continues into the next case
= vs == pitfall= assigns; == compares. if (a = b) assigns b to a and checks if non-zero (often unintended)
Examples of undefined behaviorDereferencing NULL, buffer overflow, using uninitialized variables, accessing freed memory

Everything the deck makes you recall

Address-of and dereference operators, sizeof, null pointers, function pointers and their declaration syntax; malloc, calloc, realloc, free, memory leaks, dangling pointers, segmentation faults, buffer overflows, the absence of bounds checking; struct, union, enum, typedef, dot versus arrow access, _Bool and stdbool.h; static, extern, const, volatile, register; #include, #define, #ifdef, angle brackets versus quotes; argc, argv, both legal main signatures; printf, scanf, strcpy, strncpy, strlen, the \0 terminator, ternary and comma operators, prefix versus postfix increment.

Fix the capitalisation before you memorise it

Nine fronts are sentence-cased by the deck's generator: Sizeof, Argc, Argv, Printf, Scanf, Malloc, Realloc, Strcpy, Strlen. In C every one of those is lowercase, and Printf will not compile. Read the capital as a formatting artefact, never as the identifier. Four of the same cards also lost their opening question — Main function, Switch statement, Malloc, Strlen all have answers ("An int value…", "NULL - always check the return value…") that only parse as what does X return / take? Restore the question mentally and they work as fill-in-the-blank prompts.

Two backs to correct, one drill to add

Card 74 says strings are passed "by reference", which contradicts card 32 and the language itself: C has no pass-by-reference. The pointer is copied by value — that is exactly why &variable is needed to modify a caller's data. And strncpy is sold as the safer alternative to strcpy; it is not, because it silently omits the null terminator when the source fills the buffer. Prefer snprintf, which the same card also lists. (Minor: card 39 announces "three comment styles" and supplies two.)

The drill: answer every pointer card with a drawing, not a sentence. Two boxes, one arrow, the address written inside. Array decay, ptr+1, dangling pointers and char* const all become obvious in that notation and stay ambiguous in prose.

Deck AW7614 — C: Pointers, Memory & Syntax is in the Flip It library at flip-it.app. Coming from a managed language? The contrast with C# and .NET Core — garbage collection, boxing, the CLR — makes both decks stick faster.

Ready to learn faster? 🚀

Join FLIP IT for free and turn studying into a game.

Create my free account