Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Pointer to an array of pointers

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 29-12-2009
Member
 
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?

Reply With Quote
  #2  
Old 29-12-2009
Member
 
Join Date: Apr 2008
Posts: 2,000
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;
}
Reply With Quote
  #3  
Old 29-12-2009
Member
 
Join Date: May 2008
Posts: 2,291
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;
 )
Reply With Quote
  #4  
Old 29-12-2009
Member
 
Join Date: May 2008
Posts: 2,007
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;
 )
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 12:21 PM.