c_idioms

scanf skip rest of the line

while (getchar() != '\n')
    ;

scanf skip blanks

while ((ch = getchar()) == ' ')
    ;

length of an array

int len = sizeof(a)/sizeof(a[0]);

linked list traversal idiom

Visit nodes in a linked list, using a pointer variable p to keep track of the “current” node.

for (p = first; p != NULL; p = p->next)

credit

c_programming_a_modern_approach c

backlinks