A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
int *p, q; declares one pointer and one int. Most people reading it quickly assume both are pointers. They are wrong. The * binds to the declarator, not the type. Declaring one variable per line eliminates this ambiguity entirely. int *p; int q; is unambiguous. The style costs vertical space. It saves debugging time. Every major C style guide, from the Linux kernel to BSD to CERT C, recommends it.
#include <stdio.h>int main(void) {int *a, b;int *c;int d;printf("sizeof(a)=%zu sizeof(b)=%zu\n", sizeof(a), sizeof(b));printf("sizeof(c)=%zu sizeof(d)=%zu\n", sizeof(c), sizeof(d));return 0;}
a is 8 bytes (pointer). b is 4 bytes (int). The multi-declaration hid the difference. The single-declaration lines make it obvious. In a code review, int *a, b; requires the reviewer to parse the grammar. int *a; int b; requires no parsing. The style rule is a readability optimization that also prevents bugs.
One variable per line. Pointer star next to the name. No multi-declarator lines. Three style rules that cost nothing and prevent an entire category of misreading. Next: %f vs %lf in printf and scanf, a difference that matters in one direction but not the other.
Finish the lesson once you have worked through the material. This awards ★ 10 XP.