Results 1 to 4 of 4

Thread: Pointer to an array of pointers

  1. #1
    Join Date
    Aug 2006
    Posts
    173

    Pointer to an array of pointers

    How to declare simply:
    - pointer array? A pointer to a pointer does not mean anything. It is always a pointer to something (an object )
    - pointer to array of pointers?
    - table of pointers to arrays?
    - Difference between pointer to an array and array of pointers?

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Pointer to an array of pointers

    Use pointer to pointer integers :
    Code:
    #include <iostream.h>
    
    int main()
    {
    // int * (arr *) [10]; this is not correct
    int **aa; // use this trick
    int k;
    aa=new int*[3];
    for(j=0;j<3;j++)
    aa[j]=new int[4];
    
    return 0;
    }

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: Pointer to an array of pointers

    Pointer to an array of pointers :
    Code:
    # include <stdio.h> 
    
     # define N 3
     int main (void)
     (
       / * Array of pointers to char * /
       char * t [N] = ( "RAM", "the", "C");
    
       / * P is a pointer to an array of pointers to char and
     initialized at t above * /
       char * (* p) [N] = & t;
    
       
       int i;
    
       for (i = 0; i <N; i + +)
         printf ( "% s", (* p) [i]);
       printf ( "\ n");
    
       return 0;
     )

  4. #4
    Join Date
    May 2008
    Posts
    2,012

    Re: Pointer to an array of pointers

    Pointer to an array :
    Code:
     # include <stdio.h>
    
     # define N 3
     int main (void) 
     (
     int t [2] [N] = ((14, 19, 15), (21, 11, 2009));
     int (* p) [N] = & t [1];
    
     printf ( "% d \ n", (* p)  [2]);
    
     return 0;
     )
    Array of pointers to arrays :
    Code:
    # include <stdio.h>
    
     # define N 3
     int main (void)
     (
       int t0 [5] = (55, 33, 75, 21, 29);
       int t1 [5] = (8, 23, 45, 54, 69);
    
       / * P is an array of 2 pointers to tables 5 int * /
       int (* p [2]) [5];
    
       / * Test * /
       p [0] = & t0;
       p [1] = & t1;
    
       printf ( "% d% d \ n", (* p [0]) [3], (* p [1]) [4]);
    
       return 0;
     )

Similar Threads

  1. Changing Stylus pointer to normal Pointer in Tablet PC
    By Kelley in forum Portable Devices
    Replies: 3
    Last Post: 21-06-2011, 07:22 PM
  2. How to use void pointer to generate 2D Array in c++
    By Conraad in forum Software Development
    Replies: 4
    Last Post: 06-02-2010, 05:14 PM
  3. Differentiation between void pointer and null pointer
    By Ram Bharose in forum Software Development
    Replies: 5
    Last Post: 18-01-2010, 12:11 PM
  4. Size of a pointer to an array of char
    By Zool in forum Software Development
    Replies: 3
    Last Post: 14-10-2009, 12:05 PM
  5. Pointer to an array of structures
    By Zool in forum Software Development
    Replies: 3
    Last Post: 13-05-2009, 10:51 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,248,337.96213 seconds with 17 queries