C language pen question selection 2 --- int a [10]; which of the following cannot represent the address of a [1?
Question: int a [10]; which of the following cannot represent the address of a [1?
A, a + sizeof (int)
B. & a [0] + 1
C, (int *) & a + 1
D, (int *) (char *) & a + sizeof (int ))
# Include
Int main () {int a [10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; printf ("******** output address ******** \ n"); printf ("a [0] = % d \ n ", a); printf ("a + sizeof (int) = % d \ n", a + sizeof (int); // a + 1 is the address plus 4, this is equivalent to adding 16 printf ("& a [0] + 1 = % d \ n", & a [0] + 1) to the address ); // This addition of 1 is also the address plus 4 printf ("(int *) & a + 1 = % d \ n", (int *) & a + 1 ); // Add 1 is also the address plus 5 printf ("(int *) (char *) & a + sizeof (int) = % d \ n", (int *) (char *) & a + sizeof (int); // here, the address is first converted to a char pointer, and then + 4 is added based on the char length, finally, it points to the integer printf ("\ n"); printf ("***************** \ n "); printf ("a [0] = % d \ n", * a); printf ("a + sizeof (int) = % d \ n ", * (a + sizeof (int); printf ("& a [0] + 1 = % d \ n", * (& a [0] + 1 )); printf ("(int *) & a + 1 = % d \ n", * (int *) & a + 1); printf ("(int *) (char *) & a + sizeof (int) = % d \ n ", * (int *) (char *) & a + sizeof (int); return 0 ;}
Output:
Result:
The answer is.