ISO C++ forbids comparison between pointer and integer

Hi when I try compile code from this site : http://www.cplusplus.com/articles/S8hv0pDG/

I get error here:

1
2
3
4
5
6
7
8
9
void DeleteFromTheList(INDEX idx)
{
	if(entryCount != idx) 
		for(int i = idx; i < entryCount; i++) {
			entryList<i>->name = entryList[i+1]->name;
			entryList<i>->mark = entryList[i+1]->mark;
		} 
	delete entryList[entryCount];
}


Compiler: "ISO C++ forbids comparison between pointer and integer"
"excepted primary-expression before '->' token"

What does it mean?? Thanks...
closed account (DSLq5Di1)
<> is used for template parameters, replace instances of entryList<i> with entryList[i].
closed account (N85iE3v7)
Looking at it briefly tells me that there might be a typo, or something went wrong during the creation of the html page. I think that where it is written "<i>" the author meant actually "[i]", which makes sense since you accessing elements of entryList that is an array of pointers. I would not call it an error, this is a thing that happens when you use automatic tools to generate html from C++ source code. Below, how it should work:

1
2
3
4
5
6
7
8
9
void DeleteFromTheList(INDEX idx)
{
	if(entryCount != idx) 
		for(int i = idx; i < entryCount; i++) {
			entryList[i]->name = entryList[i+1]->name;
			entryList[i]->mark = entryList[i+1]->mark;
		} 
	delete entryList[entryCount];
}



It works....thx a lot
Topic archived. No new replies allowed.