003 C / C ++ data type array _

#include " stdio.h " 
#include " stdlib.h " 

// . essence data types: fixed-size memory block alias 
void main () 
{ 
    int A;        // tell the compiler allocates four bytes of memory. 
    int B [ 10 ]; // tell the compiler allocates 4 * 10 bytes of memory. 

    the printf ( " B:% D, B +. 1:% D, & B:% D, & B +. 1:% D \ n- " , B, B + . 1 , & B, B & + . 1 ); 
    the printf ( " the sizeof (A): D%, the sizeof (B): D% \ n- " , the sizeof (A), the sizeof (B));
     //The two print result:
     // B: 4.12842 million, B +. 1: 4,128,424, & B: 4.12842 million, & B +. 1: 4.12846 million
     // the sizeof (A):. 4, the sizeof (B): 40 
    
    // Analysis:
     // B + 1 <> & b + 1 ?? because different b and & b data types.
     // b: represents the address of the first element of the array.
     // & b: represents the address of the entire array. 


    System ( " PAUSE " ) ; 
}

 

Guess you like

Origin www.cnblogs.com/it89/p/11069071.html