Array as Pointer in C
Level 381 keystrokes
Demonstrates that array name acts as a pointer to the first element.
C code
// Three ints stored next to each other in memory1int arr[] = {10, 20, 30};// In an expression, arr turns into the address of arr[0], so no & is needed2int *p = arr;// p+1 moves one int forward, not one byte; *(p+1) is the same as arr[1]3printf("%d %d %d\n", *p, *(p+1), *(p+2));Output
10 20 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*× 4;× 3(× 3)× 3%× 3"× 2+× 2=× 2[× 1