Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > std::stack comp...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 45759 of 45898
Post > Topic >>

std::stack compilation error

by Rahul <sam_cit@[EMAIL PROTECTED] > May 5, 2008 at 08:19 AM

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 ! ! !




 3 Posts in Topic:
std::stack compilation error
Rahul <sam_cit@[EMAIL   2008-05-05 08:19:16 
Re: std::stack compilation error
Christian Hackl <hacki  2008-05-05 17:32:14 
Re: std::stack compilation error
Rahul <sam_cit@[EMAIL   2008-05-05 08:48:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 6:53:47 CDT 2008.