cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
multi dimensional array
multi dimensional array
Oct 15, 2013 at 11:14am UTC
amitk3553
(102)
i have to numbers 12345678
87654321
and to store in array.
int arr[2][8];
arr[1][8] = 12345678;
arr[0][8] = 12345678;
Please correct!!!
Oct 15, 2013 at 11:28am UTC
rodiongork
(167)
arr[0] = {1,2,3,4,5,6,7,8};
read something on basic arrays and its syntax - it would not be easy to struggle through without this simple knowledge.
by the way are you sure you need multi-dimensional arrays here?
Oct 15, 2013 at 11:33am UTC
keskiverto
(10402)
What there is to correct?
Apart from:
For array
foo[N]
the range of valid indices is from 0 to N-1. In your example, you do dereference element [8], which is one past the valid range.
Oct 15, 2013 at 11:34am UTC
machinafour
(66)
Not sure exactly what you are asking here but maybe you don't need a multidimensional array??
1
2
3
4
int
arr[2]; arr[0] = 12345678; arr[1] = 87654321;
Oct 16, 2013 at 6:32am UTC
amitk3553
(102)
yes i need no multidimensional array
solved
Topic archived. No new replies allowed.