Possible Duplicate:
Multi-dimensional array and pointers in C++?
Hi,
In 1D I can declare an array like,
int *image = new int[W*H];
But in 2D how can I declare an array?
int *image = new int[W][H]; -- is it wrong??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It will NOT compile. You should compile your code first, to know the answer of your question.
I think you want to do this:
But then why do all these when you’ve
std::vector? You could use it which will do all these nasty thing itself. Here is how you should be usingstd::vector: