Summary of C language pointers
# Include
Void main () {int a [3] = {1, 3, 5}; // One-dimensional array int * num [3] = {& a [0], & a [1], & a [2]}; // pointer array int ** p pointing to the pointer int I of a one-dimensional array with an array length of 3; p = num; // pass the first address of num to p. p stores the first address of num for (I = 0; I <3; I ++) {printf ("& p % d = % d \ t", I, & p ); // specifies the address of the pointer to the pointer printf ("p % d = % d \ t", I, p ); // printf ("* p % d = % d \ t", I, * p ); // printf ("& num [% d] = % d \ t", I, & num [I]); // num [I] address printf ("num [% d] = % d \ t", I, num [I]); // num [I] The address value printf ("& a [% d] = % d \ t", I, & a [I]); // The address printf ("% d \ n", ** p) of a [I ); // The value stored on the address pointed to by the pointer to p ++ ;}}
# Include
Void main (int argc, char * argv []) // Number of argc function parameters argv points to each parameter {printf ("argc = % d \ n", argc ); for (int I = 0; I
# Include
// Void main () {int a [5] = {1, 2, 3, 4, 5}; int * p1, * p2; p1 = & a [0]; p2 = & a [4]; printf ("% d \ n", P2-P1); // point to the same Array pointer minus if (p2> p1) // compare printf ("% d \ n", * p2) with the array pointer; elseprintf ("% d \ n", * p1 );}