Today, we tested the array Address Transfer Method in vc6 and found that in the main function, the address pointed to by the array name is the same as the address of every 0 element in the array, however, when an array is passed to the called function, the parameter of the called function receives the address of the real parameter in the form of a pointer.
BelowProgramWhen you run the program for the first time, you can view the address assigned to the array by the system and then change the program;
2: change the "1245044" next to printf ("4: \ t1231644 = % s \ n", 1245044); the address assigned to your array by your system, run the command again.
1: Change // # define debug to # define debug.
# Include <stdio. h>
# Include <string. h>
// # Define debug
Int arrayaddress (char caarray [])
{
Printf ("2: \ t & caarray = % d \ tcaarray = % d \ n", & caarray, caarray );
Return 0;
}
Int main (void)
{
Char array [10] = "hello ";
Printf ("1: \ t & array = % d \ tarray = % d \ n", & array, array );
Arrayaddress (array );
Printf ("3: \ t & array = % d \ tarray = % d \ n", & array, array );
# Ifdef debug
Printf ("4: \ t1231644 ==% s \ n", 1245044 );
# Endif
Return 0;
}