How can I create an array of pointer using **P and point it to NULL?

Let's say I have coded as below .

struct s
{
    float  a ;
    char x ;
} ;

s  **p ;

p = new ( s  * [10] ) ;

Now I want to make some of them as NULL

p[0] = NULL ;

p[5] = NULL ;

If I simply coded as above then it gives me a warning and also the above method is wrong in how it makes the variable NULL. So how to do I do this?

You need to run your pointer in a loop and randomly insert NULL.
pseudo code...

for(n=0;n<10;n++)
  for(y=0;y<10;y++}
    if(y%2==0)
       p[y][x]=NULL;
    p[y][x]=y+x;

Hope this help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.