Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Cpp noobie problem

Name: Anonymous 2013-03-18 21:30

int iZero = 0;
int iTwo = 0;

char aTest[2][2] = {{'4','4'}, {'X','O'}};
aTest[1][0] = 'b';
    if(aTest[iZero][iTwo] == 'X'){
          cout <<  "Garsh\n";   
    };

//Doesn't work...
//[Error] 'iZero' was not declared in this scope
//[Error] 'iTwo' was not declared in this scope

How do I fix it? So I can reference the matrix with two given variables?

Name: Anonymous 2013-03-18 21:35

aTest is 1,0 not 0,0

Name: Anonymous 2013-03-18 21:37

My bad but I'm trying to reference any value of the array by changing iZero and iTwo... aTest[1][0] = 'b' might as well be left out, I forgot to remove that bit.

Name: Anonymous 2013-03-18 21:41

the error is resulting from the second column's first memory space holding null, the first column has 'b'

Name: Anonymous 2013-03-18 21:43

The error comes from the fact you haven't asked Stack Overflow.

Name: Anonymous 2013-03-18 21:47

Name: sage 2013-03-18 21:48

The error came from a syntax flaw. Sorry & thanks

Name: Anonymous 2013-03-18 22:23

That's C++, not cpp (C Preprocessor). They're different things.

Name: Anonymous 2013-03-19 0:25

>>8
but finding the plus sign on the keyboard is haaaaaaaaaaaaard

Name: Anonymous 2013-03-19 0:38

>>9
That's why I always do #define plus + at the top of my programs.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List