Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Quote:
Warning: makes integer from pointer without a cast:
Note->Bstnode is a node of binary tree amp is structure of queue




Is this error that I am getting is due to amp->array[amp->rear]=root; because root is a pointer If then what will be the way if I want to store the address of struct Bstnode that is the address of nodes of BST in a queue. Please give a pointer to my error

What I have tried:

void enqueue(struct queue* amp,struct Bstnode* root){
    if(isfull(amp))
       return;
    else if(isempty(amp))
    {
       amp->rear=0;
       amp->front=0;
       amp->array[amp->rear]=root;
    }
    else
    {
        amp->rear=((amp->rear+1)%(amp->capacity));
        amp->array[amp->rear]=root;
    }

}
Posted
Updated 17-Aug-18 6:15am

1 solution

You cannot use a pointer as an array offset. If amp->rear is a pointer then you must use it as a pointer. It would make more sense to make it an integer value to use as an array index.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900