Arrays
Yes, arrays in C/C++ start with an index of 0, not 1.
It's not what you're taught, it's what you learn.
The following works for me:
int number[10][7] =
{1,1,1,0,1,1,1
,0,0,1,0,0,1,0
,1,0,1,1,1,0,1
,1,0,1,1,0,1,1
,0,1,1,1,0,1,0
,1,1,0,1,0,1,1
,1,1,0,1,1,1,1
,1,0,1,0,0,1,0
,1,1,1,1,1,1,1
,1,1,1,1,0,1,0};
So, it looks like you can initialize 2-dimension arrays as if it were a 1-dimensional array. I am using MSVC++ 6.0. Maybe this is only available in C++ and not in C? I have no idea. All I know is that it works.
Jason Doucette
http://www.jasondoucette.com/
int number[10][7] =
{1,1,1,0,1,1,1
,0,0,1,0,0,1,0
,1,0,1,1,1,0,1
,1,0,1,1,0,1,1
,0,1,1,1,0,1,0
,1,1,0,1,0,1,1
,1,1,0,1,1,1,1
,1,0,1,0,0,1,0
,1,1,1,1,1,1,1
,1,1,1,1,0,1,0};
So, it looks like you can initialize 2-dimension arrays as if it were a 1-dimensional array. I am using MSVC++ 6.0. Maybe this is only available in C++ and not in C? I have no idea. All I know is that it works.
Jason Doucette
http://www.jasondoucette.com/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement