array of pointers

A

aki

Hi ,
i want to declare array of pointers of type node .
am i wight in this..?? or will it do some problem //
thanks
Aki
..
struct node
{
int data;
node* ptr;
}
int NUM;
cin>>NUM;
node *ARR[NUM];
 
S

Sinan

Hi ,
i want to declare array of pointers of type node .
am i wight in this..?? or will it do some problem //
thanks
Aki
.
struct node
{
int data;
node* ptr;}
^^^^^^^^^^^^
Also this line is going to cause error.
int NUM;
cin>>NUM;
node *ARR[NUM];

struct node *ptr[10]; /* 10-element array of pointers */
 
S

S James S Stapleton

Richard Heathfield said:


Sorry, that should be:

typedef struct node_ node;

to add some small confusion, can't you also do this?

struct node_;
typedef struct node_ node;

struct node_
{
int data;
node *ptr;
}

or...
typedef struct node_
{
int data;
struct node_ *ptr;
}


many ways... one cat.

Everyone has a preference on which is more readable. As a friend of mine put
it, "Programming is as much a science about computers as it is about the
psychology of the programmers"

-Jim Stapleton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top