My C++ Quiz

The ultimate place to learn C++!

Question #11: What value does size print out?

#include <iostream>

const int SIZE = 5;

struct tester
{
    int array[SIZE];

    enum 
    {
        SIZE = 3
    };

    void size()
    {
        std::cout << sizeof(array) / sizeof(int);
    }
};

int main(int argc, char** argv)
{
    tester t;
    t.size();
    return 0;
}