My C++ Quiz

The ultimate place for testing what you have learned



Home | Start Quiz | List of questions  | Login / Register

Question #75: Which of the following implementations of the reset function is best for initializing the array to all zero.
58% on 885 times asked

class foo{
public:
    foo(){
        reset();
    }
private:
    void reset(){

    // A // memset(x, 0, 50);
    // B // memset(x, 0, sizeof(x));
    // C // memset(x, 0, 50 * 4);
    // D // memset(x, 0, 50 * sizeof(x));
    }

    long x[50];
};

A
B
C
D
none of them will work
© 2007-2010, My C++ Quiz, All rights reserved.
Can you find a bug in the quiz? Can you think of a new question that would be cool to add to this site? Email us and we will take action:
email us
Other Quizes | Contributors