Typedef in C
Level 4111 keystrokes
Uses typedef to create an alias for a structure type.
C code
// typedef creates an alias 'Time' for the anonymous struct1typedef struct {2 int hours;3 int minutes;4} Time;5 // Use Time directly without 'struct' keyword6Time t = {10, 30};// %02d pads with a leading zero to 2 digits (prints 10:30)7printf("%02d:%02d\n", t.hours, t.minutes);Output
10:30
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this C code and how often they appear.
;× 5,× 3.× 2"× 2{× 2}× 2%× 2:× 1(× 1)× 1