~/devtype

C Typing Speed Test

C puts the asterisk and ampersand at the center of everything — declaration, dereference, and address-of. Typing C fluently means handling `*ptr`, `&val`, and `p->member` without breaking concentration on the memory model.

LV 1
Level 0 / 100 XP
Best 0 WPM
main.js
00 wpm
00%
0s
1
Just start typing or click the code
Esc restart Enter new line, indentation is skipped for you

Pointers Are a Typing Problem Too

The asterisk serves triple duty in C — pointer declaration (`int *p`), dereference (`*p = 5`), and multiplication — making Shift-8 one of your most-typed combinations. The arrow operator `->` for struct member access through pointers pairs hyphen and greater-than in a sequence that must become a single motion, because it appears in virtually every function that touches a struct.

Format strings add their own vocabulary: `printf("%s is %d\n", name, age)` mixes percent specifiers, escaped newlines, and comma-separated arguments. Preprocessor directives start lines with `#`, semicolons terminate everything, and header guards shout in ALL_CAPS_WITH_UNDERSCORES. These drills use real allocation, string handling, and struct code so every C-specific pattern gets repetitions.

Key Drills for C:

  • Asterisk placement: Drill `*` in both declaration and dereference position — your hands should not distinguish them.
  • Arrow through structs: `->` appears constantly in real C. Type hyphen-greater-than as one strike.
  • Escape sequences: `\n`, `\0`, and `%d` are C's punctuation. Practice format strings until backslash reaches are automatic.

Sample Drill: Pointers & Memory Allocation

Allocating, using, and freeing heap memory with pointers.

c-pointer · medium
int *scores = malloc(count * sizeof(int));
if (scores == NULL) {
    fprintf(stderr, "allocation failed\n");
    return 1;
}
for (int i = 0; i < count; i++) {
    scores[i] = i * i;
}
free(scores);

All 15 C Drills

Every session picks a random drill from this pool. Use the difficulty filter above to stay on easy warm-ups or jump straight to the hard ones.

  • Structs & Typedef easy

    Defining a typedef struct and accessing members via pointer.

  • Reading a File Line by Line easy

    Open a text file with fopen and echo each line read by fgets.

  • Enums & Lookup Tables easy

    Map enum values to names with a parallel string array.

  • Function-like Macros easy

    Use parenthesized macros to get array length and a maximum value.

  • Command-line Arguments easy

    Validate argc and print a usage message to stderr when arguments are missing.

  • Pointers & Memory Allocation medium

    Allocating, using, and freeing heap memory with pointers.

  • Sorting with qsort medium

    Sort an int array with qsort and an overflow-safe comparator.

  • Bit Flags & Masks medium

    Set, clear, and test permission bits with bitwise operators.

  • Safe Integer Parsing medium

    Parse a port number with strtol, checking errno, leftovers, and range.

  • djb2 String Hash medium

    Compute the classic djb2 hash of a NUL-terminated string.

  • String Handling & Bounds hard

    Safe string copy with strncpy and manual null termination.

  • Growable Array with realloc hard

    Append to a dynamic int array, doubling capacity and handling allocation failure.

  • Reverse a Linked List hard

    Reverse a singly linked list in place by relinking next pointers.

  • Goto Cleanup Pattern hard

    Release resources in reverse order using labeled goto error paths.

  • Fixed-size Ring Buffer hard

    Push bytes into a circular buffer that wraps its head index with modulo.

The Symbols That Slow You Down

The keystrokes below are where C typing speed is won or lost. Key positions shown for QWERTY — the pattern transfers to any layout, just on different physical keys.

Symbol Used For Keys How to Drill It
* Pointer / deref Shift+8 Declaration (`int *p`), dereference (`*p`), and multiplication in one key. Shift-8 is C's most-typed symbol.
& Address-of Shift+7 `scanf("%d", &x)` — passing addresses constantly. And `&&` for logical AND is a doubled strike.
-> Struct arrow - unshifted, then > as Shift+Period Member access through pointers: `node->next`. Appears in virtually every struct-heavy function.
# Preprocessor Shift+3 `#include`, `#define` start lines. A line-initial Shift-3 reach that should be automatic.
% Format specifier Shift+5 `%s`, `%d`, `%f`, `%p` — percent-letter pairs repeat through every printf. Type them as two-strike chunks.
\n Escape sequence Backslash unshifted (above Enter), then letter Backslash-letter pairs (`\n`, `\0`, `\t`) inside strings — an unshifted reach most typists never drilled.

Common C Typing Mistakes

  • ✗ Placing the asterisk inconsistently (`int* p` versus `int *p`) — pick one style; hesitation here doubles your keystroke cost.
  • ✗ Missing the semicolon after struct definitions and statements — the right pinky should close every C line.
  • ✗ Escaping quotes inside strings incorrectly — drill complete printf patterns end to end rather than characters.

What's a Good C Typing Speed?

Pointer-heavy C types slower than you'd expect for so few keywords: 25–40 WPM is solid working speed, with 45+ WPM at 96%+ accuracy being excellent. Format strings and the arrow operator are the usual bottlenecks.