Initialize a two-dimensional array

T

Tony Johansson

Hello Experts!!

I know that you can initialize a two-dimensional array of integer in this
way
int number[][3] = { {1,6,78}, {7,2,23} }
Here we have declared a two dimensional array with 2 rows, each row
containing three elements.

But now to my question can you declare and initialize a two-dimensional
array in this way or is it nessesary to define the size of each element as I
did above with 3 in that example.
int number[][] = { {1,6,78}, {7,2,23} }

//Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,567
Members
47,204
Latest member
abhinav72673

Latest Threads

Top