Nov 15, 2009 at 8:20am UTC
i am totally lousy in programming i was trying to do a multidimensional arrays with 8X8 like this and - the value of 128.
#include <iostream>
using namespace std;
void original_block()
{
int a[8][8];
int first;
*(a+0)[0] = first;
int second;
*(a+0)[1] = second;
int third;
*(a+0)[2] = third;
cout << "enter value" << endl;
cin >> first;
cin >> second;
cin >> third;
cout << first << " " << second << " " << third << endl;
}
int main ()
{
original_block ();
return 0;
}
Nov 15, 2009 at 9:08am UTC
I think your assignment is backwards, always remember it's right to left. Kinda hard to tell what your code is trying to do. Can you explain what you are trying to achieve in english like solution?
eg.
first = 1+1; --< correct first is 2.
1+1 = first <<< not so correct.
right is the value, left is what your assigning the value to.
Last edited on Nov 15, 2009 at 9:11am UTC
Nov 15, 2009 at 9:12am UTC
sorry I just got it, the array is named a... are you getting errors or you just want to know if this is correct?
Last edited on Nov 15, 2009 at 9:13am UTC
Nov 15, 2009 at 1:18pm UTC
yes is working but i am trying to do an multidimensional arrays with 8X8 and minus the 8X8 arrays with value of 128.
Last edited on Nov 15, 2009 at 1:44pm UTC
Nov 15, 2009 at 7:15pm UTC
*(*(a+0) + 0) - first
*(*(a+0) + 1) - second
...
*(*(a+1) + 0) - ninth
Last edited on Nov 15, 2009 at 7:15pm UTC