sizeof() headaches

From: Val (valmont_gaming_at_hotmail.com)
Date: 12/22/03


Date: Mon, 22 Dec 2003 23:13:55 +0100

Observe this little code:

#include <string>
using namespace std;
class A
{
public:
void SetArray(string* array)
{
    sArray = array;
    Size = sizeof array / sizeof *array; // does not work! "sizeof array"
returns 4.... should be 7*16.
}
private:
string* sArray;
size_t Size;
};

int main()
{
    string SomeStringArray[7] = {"word1","word2","word3",
    "word4","word5","word6","word7"};

    A Obj1;
    Obj1.SetArray(SomeStringArray);

    return 0;
}

Why isn't my sizeof operator not working like this?
I need this to implement a private helper method wich calculates the number
of elements in sArray, buy using the sizeof operator if possible.
What are my options (wich are reasonable)?