有人可以解释C指针

-6 c pointers

有人可以解释为什么v [2]最终得到的值为-3,而不是为空,或者25为什么?

#include <stdio.h>

 int main ()
 {
   int v[5];
   int *z = &v[0];
   *z=12;
   z++;
   *z=16;
   z++;
   *z=-3;
   z++;
   *z=25;

   printf ("%d", v[2]);
   return 0;
 }
Run Code Online (Sandbox Code Playgroud)

Rya*_*ugh 5

#include <stdio.h>
int main ()
{
    int v[5];
    int *z = &v[0]; // z points to v[0]
    *z=12; // v[0] = 12
    z++;   // z points to v[1] now
    *z=16; // v[1] = 16
    z++;   // z points to v[2] now
    *z=-3; // etc
    z++;   // etc
    *z=25; // etc
}
Run Code Online (Sandbox Code Playgroud)