New? Dynamically allocate array space?. Xml

Source: Internet
Author: User

Pre{line-height:1;color: #3c3c3c; Background-color: #d2c39b; font-size:16px;}. Sysfunc{color: #627cf6; font-style:italic;font-weight:bold;}. Selffuc{color: #800080;}. Bool{color: #d2576f;}. Condition{color: #000080; font-weight:bold;}. Key{color: #000080;}. Var{color: #800000; font-style:italic;}. Digit{color: #ff00ff; font-weight:bold;}. Includepre{color: #3c3c3c;}. operator? {color: #008000; font-weight:bold;}

?? (i) define an integer?????????????
   
    Int?*
    
     P?
     
      =
      
       New?
       
        Int;????????
        
         Int?*
         
          P?
          
           =
           
            New?
            
             Int
             
              (
              
               4
               
                );? Assigning an initial value
                
                 4?? (ii) Define a one-dimensional array?????????????????
                 
                  Int?*
                  
                   P?
                   
                    =
                    
                     New?
                     
                      
                       int[ 
                       
                        SIZE];????????? 
                        
                         p? points to the first address of the array, which is the 
                         
                          base unit of type int, and 
                          
                           p is used as the array name?? (iii) Define a two-dimensional array?????? 
                           
                            int 
                            
                             (* 
                             
                              p 
                              
                               ) [ 
                               
                                column]= 
                                
                                 New? 
                                 
                                  int? [ 
                                  
                                   size][ 
                                   
                                    Column]???????????? 
                                    
                                   
                                  
                                 
                                
                               
                              
                             
                            
                           
                          
                         
                        
                      
                     
                    
                   
                  
                 
                
               
              
             
            
           
          
         
        
       
      
     
    
   

First define a pointer (*p) [Column], which indicates that the pointer is in size? column int type? The space is the basic unit, and the new?int[size behind] ... To open up a size space

?

? The first pointer represents a pointer unit in the first two cases???????????? The second pointer represents the pointer element in the case of a two-dimensional array, so that when a two-dimensional array, the pointer is
   
    Column? A
    
     IntThe size of the space is a basic unit of the???????????????
     
      P[
      
       0][
       
        0]? indicates that the first
        
         0Such a basic unit.
         
          0The value of an element??????????
          
           P[
           
            1][
            
             0]? indicates that the first
             
              1Such a basic unit.
              
               0The value of an element????????? Therefore, declaring a two-dimensional array pointer?????????????????
               
                Int?
                
                 (*
                 
                  P
                  
                   
                    ) [ 
                    
                     column];//? 
                     
                      p points to the [ 
                      
                       column] structure, and the [ 
                       
                        column] structure is the 
                        
                         ???????? of the base unit of type int Similarly, three-dimensional arrays can be defined as follows:??????????????? 
                         
                          int? 
                          
                           (* 
                           
                            p 
                            
                             ) [column_1][column_2]= 
                             
                              new? 
                              
                               int? [ 
                               
                                size][column_1][column_2]
                                
                               
                              
                             
                            
                           
                          
                         
                        
                       
                      
                     
                   
                  
                 
                
               
              
             
            
           
          
         
        
       
      
     
    
   

?

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

New? Dynamically allocate array space?. 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.