invalid conversion from int* to int

its getting invalid conversion from int* to int in this section int s=&data[head]; please help.


#include <iostream>
using namespace std;

const int size=5;
int data[size];
int add[size];
int head = 1;

void AddLast(int value)
{
if(head==1)
{
data[head]=value;
int s=&data[head];
add[size]= s;

}
else
{
head++;
head=data[value];
}
}
Last edited on
int s=&data[head];

You're dereferencing, then referencing again, resulting in an int* being assigned to an int. Do you see why?

-Albatross
Topic archived. No new replies allowed.