Int? (*p) [4]?p? is a level two pointer? A two-dimensional array? Level two pointer?. Xml

Source: Internet
Author: User

Pre{line-height:1;color: #2f88e4; Background-color: #e9ffff; font-size:16px;}. Sysfunc{color: #3d7477; font-style:italic;font-weight:bold;}. Selffuc{color: #a0b684;}. Bool{color: #86ddd8;}. Condition{color: #94e269; font-weight:bold;}. Key{color: #ae0bfd;}. Var{color: #e81cb6; font-style:italic;}. Digit{color: #ef09ef; font-weight:bold;}. Includepre{color: #e4882f;}. operator? {color: #96d186; font-weight:bold;}

Test One:

   
    Int?
    
     A[
     
      3][
      
       4]={
       
        1,
        
         2,
         
          3,
          
           4,
           
            5,
            
             6,
             
              7,
              
               8,
               
                9,
                
                 10,
                 
                  11,
                  
                   12
                   
                    };
                    
                     Int?
                     
                      (*
                      
                       P
                       
                        )[
                        
                         
                          4]; 
                          
                           for 
                           
                            ( 
                            
                             p 
                             
                              =& 
                              
                               a[ 
                               
                                0]; 
                                
                                 p<& 
                                 
                                  a[ 
                                  
                                   0]+ 
                                   
                                    3; 
                                    
                                     p++) 
                                     
                                      cout<<& 
                                      
                                       p<<endl; 
                                       
                                      
                                     
                                    
                                   
                                  
                                 
                                
                               
                              
                             
                            
                           
                         
                        
                       
                      
                     
                    
                   
                  
                 
                
               
              
             
            
           
          
         
        
       
      
     
    
   

0012ff40

0012ff40

0012ff40

 
    
     
  For
  
     
      
   (
   
      
       
    p
    
       
        
     =&
     
        
         
      a[
      
         
           0]; 
          
            p<& 
           
             a[ 
            
              0]+ 
             
               3; 
              
                p++) 
               
                 cout<< 
                
                  p<<endl; 
                 
                
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

0012ff44

0012ff54

0012ff64

 
    
     
  For
  
     
      
   (
   
      
       
    p
    
       
        
     =&
     
        
         
      a[
      
         
           0]; 
          
            p<& 
           
             a[ 
            
              0]+ 
             
               3; 
              
                p++) 
               
                 cout<<* 
                
                  p<<endl; 
                 
                
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

0012ff44

0012ff54

0012ff64

 
    
     
  For
  
     
      
   (
   
      
       
    p
    
       
        
     =&
     
        
         
      a[
      
         
           0]; 
          
            p<& 
           
             a[ 
            
              0]+ 
             
               3; 
              
                p++) 
               
                 cout<<** 
                
                  p<<endl; 
                 
                
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

1

5

9

Summarized as follows:

???
   
    Pis a level two pointer??? &
    
     P? is the address of the cell that holds this level two pointer?: 0012ff40???
     
      PThe value is: 0012ff44??? *
      
       P? is
       
        
          P points to the contents of the unit, because 
         
           P is a level two pointer and 
          
            P points to a combined unit (composed of four shapes), so? The compiler will? * 
           
             P is interpreted as the address of the first element in a composition unit: 0012ff44??? * * 
            
              P? is the value of the first element in the first row? 
             
               1??? This level two pointer is very special, because:? 
              
                P and * 
               
                 P are the same values? But the compiler will explain them differently, 
                
                  P? is interpreted as the address of the first element of the line, the action unit is an element??? In the same vein? The two-dimensional array name 
                 
                   A, also a level two pointer??? 
                  
                    A? is the first address of the line??? * 
                   
                     A? is the first element of the line first address??      
                    
                   
                  
                  
                
               
             
            
           
          
         
        
       
      
     
    
   

Test Two:

???
 For 
    
  
     
      
   (
   
      
       
    int?
    ) 
       
        
     i
     
        
         
      =
      
         
           0; 
          
            i< 
           
             ; 
            
              i++)??? 
             
               cout<<** 
              
                a<<endl; 
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

1

1

1

1

1

1

1

1

1

1

1

1

??
 For 
    
  
     
      
   (
   
      
       
    int?
    ) 
       
        
     i
     
        
         
      =
      
         
           0; 
          
            i< 
           
             ; 
            
              i++)? ? 
             
               cout<<** (a 
              
                + 
               
                 i 
                
                  ) <<endl;
                 
                
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

1

5

9

4232719

1447838469

1245116

476002356

4269248

2088857559

-
 
    
     
  2141931795
 
    

2088999592

0

 
    
     
  For
  
     
      
   (
   
      
       
    int?
    ) 
       
        
     i
     
        
         
      =
      
         
           0; 
          
            i< 
           
             ; 
            
              i++) 
             
               cout<<* (* a 
              
                + 
               
                 i 
                
                  ) <<endl;
                 
                
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

1

2

3

4

5

6

7

8

9

10

11

12

 
    
     
  For
  
     
      
   (
   
      
       
    int?
    ) 
       
        
     i
     
        
         
      =
      
         
           0; 
          
            i< 
           
             ; 
            
              i++) 
             
               cout<<& 
              
                a<<endl; 
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

 
    
     
  For
  
     
      
   (
   
      
       
    int?
    ) 
       
        
     i
     
        
         
      =
      
         
           0; 
          
            i< 
           
             ; 
            
              i++) 
             
               cout<< 
              
                a<<endl; 
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

 
    
     
  For
  
     
      
   (
   
      
       
    int?
    ) 
       
        
     i
     
        
         
      =
      
         
           0; 
          
            i< 
           
             ; 
            
              i++) 
             
               cout<<* 
              
                a<<endl; 
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

0012ff44

 
    
     
  For
  
     
      
   (
   
      
       
    int?
    ) 
       
        
     i
     
        
         
      =
      
         
           0; 
          
            i< 
           
             ; 
            
              i++) 
             
               cout<<** 
              
                a<<endl; 
               
              
             
            
           
         
     
        
    
       
   
      
  
     
 
    

1

1

1

1

1

1

1

1

1

1

1

1

Can you see from the top? is the array name a special pointer? Because the &A is the same as the value of a?, which means that the system does not assign an address space to an array name

?? In addition, the array name is also a level two pointer

This article uses the calligraphy and painting novel software, content and software independent, calligraphy and painting fiction software? More enjoyable to read, more enjoyable to write, easier to publish.

Int? (*p) [4]?p? is a level two pointer? A two-dimensional array? Level two pointer?. Xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.