casting a node to integer

Posted by user1708762 on Stack Overflow See other posts from Stack Overflow or by user1708762
Published on 2012-11-13T04:53:24Z Indexed on 2012/11/13 4:59 UTC
Read the original article Hit count: 122

Filed under:
|
|

The code gives an error saying that "no operator matches these two operands" in the if comparison statement. I interpret,it should mean that "a node can't be converted/casted into an integer". But, the print statement prints an integer value for w[2] when used with %d format. Why is that happening? Isn't printf casting it?

NODE *w=(NODE *)malloc(4*sizeof(NODE)); 
if(w[2]==0)
  printf("%d\n",w[2]);

The structure of the node is-

struct node{
  int key;
  struct node *father;
  struct node *child[S];
  int *ss;
  int current;
};

© Stack Overflow or respective owner

Related posts about c++

Related posts about c