R
Rahul
Hi,
I have the following program,
void dfs(struct node * root)
{
if(root == NULL) return;
std::stack <struct node *> s;
s.push(root);
while(!s.empty())
{
struct node * temp = s.pop();
printf("%d ",temp->data);
s.push(temp->rptr);
s.push(temp->lptr);
}
}
and i get a error saying,
ro.c: In function `void dfs(node*)':
ro.c:419: `stack' undeclared in namespace `std'
Am i missing something?
Thanks in advance ! ! !
I have the following program,
void dfs(struct node * root)
{
if(root == NULL) return;
std::stack <struct node *> s;
s.push(root);
while(!s.empty())
{
struct node * temp = s.pop();
printf("%d ",temp->data);
s.push(temp->rptr);
s.push(temp->lptr);
}
}
and i get a error saying,
ro.c: In function `void dfs(node*)':
ro.c:419: `stack' undeclared in namespace `std'
Am i missing something?
Thanks in advance ! ! !