Structure Definition in C
Level 489 keystrokes
Defines a structure to represent a 2D point and accesses its members.
C code
// Define a structure named Point1struct Point { // Member for x coordinate2 int x; // Member for y coordinate3 int y;4};5 // Create and initialize a Point variable6struct Point p = {3, 5};// Access members using dot notation7printf("(%d, %d)\n", p.x, p.y);Output
(3, 5)
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,× 4.× 2"× 2(× 2)× 2{× 2}× 2%× 2\× 1