I have the following method in a file called index.cpp. When I compile, it’s telling me that “indexStructure” is not defined in this scope.
#include "index.h"
#include <cctype> // provides isalpha() and tolower()
#include <iostream>
#include <sstream>
using namespace std;
void index::shiftRight (int i)
{
if ( indexSize == (sizeof(indexStructure) / sizeof(indexStructre[0])))
doubleIndex();
for (int j = indexSize; j > i; j--)
indexStructure [j] = indexStructure [j-1];
}
in index.h, i have
class index
{
struct node {
string item;
int counter;
int* pageNumber;
};
...
private:
node* indexStructure;
int lineCounter;
int indexSize;
};
I intend to make an array of type node and use it to search through words in a book. Why is it undefined?
Thanks in advance
You misspelled
sizeof(indexStructre[0])inindex::shiftRight(). Correct that toindexStructureand try again.