user3281743
user3281743

Reputation: 295

Bad operand types for binary operator. Why doesn't this work?

I'm confused why this doesn't work. It's suppose to set all the table[count] to null but it wont let me.

public HashTable(int sz) {

    // Count to initalize all to null
    int counter = 0;

    // Initalizes the global size to the
    // sz passed in
    size = sz;

    // Initalizes
    table = new Base[size];
    probeCount = new int[size];

    // Initalizes all to null
    while (counter <= probeCount) {
        table[count] = null;
        counter++;
    }
}

Upvotes: 0

Views: 149

Answers (1)

Moonhead
Moonhead

Reputation: 1568

This is probably what you want to do. You're comparing two different things. You want to compare the size

        // Initalizes all to null
        while (counter <= size)/ {

            table[count] = null;
            counter++;
        }

Upvotes: 2

Related Questions