Question: Given this code:

```
#include <iostream>
using namespace std;
int main(){
  typedef struct node{
     int data;
     node* left;
     node* right;
   } nodeptr;
  nodeptr *root, *curr, *temp;
}

```

Does `nodeptr *root` and `nodeptr* root` represent the same thing?

Answer: 
> 
> Are the both codes represents the same thing ?
> 
> 
> 

They almost represent the same thing, except that the first one defines `nodeptr` as a `typedef`ed name.

> 
> Is int\* a and int \*a represents the same thing?
> 
> 
> 

Yes.

> 
> For the First code when i declared: `queue < nodeptr >q` it worked but for the second code when i declared in code: `queue < node >q` it did not worked. why?
> 
> 
> 

`queue<nodeptr> q` is the same as `queue<node*> q`. Hence the comparison is not appropriate.

You should be able to use `queue<node>` if you use C++11. See it working at <http://ideone.com/tkij08>.
1. Almost. Both define a `struct node`, but the first also defines a type for a pointer to `struct node` called `nodeptr`.
2. Nope, they are exactly the same thing. The whitespace, or lack thereof, does not matter.
3. Because in the first case you declare a queue of pointers to type node, while in the second you declare a queue of objects of type node. `queue` presumably makes an additional demand on its contents that `node` does not fulfill. Without seeing the source of `queue` it is hard to guess what that might be, but perhaps it needs a comparison-operator of some sort to be defined. If you want to know more you should really post example source and the error messages you get, and not just state 'it doesn't work'.