Click here to Skip to main content
15,912,205 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: stl iterator Pin
Robert A. T. Káldy7-Feb-04 21:24
Robert A. T. Káldy7-Feb-04 21:24 
GeneralRe: stl iterator Pin
ns9-Feb-04 1:29
ns9-Feb-04 1:29 
GeneralRe: stl iterator Pin
Robert A. T. Káldy11-Feb-04 1:24
Robert A. T. Káldy11-Feb-04 1:24 
GeneralC++ Question. Pin
WREY6-Feb-04 7:09
WREY6-Feb-04 7:09 
GeneralRe: C++ Question. Pin
David Crow6-Feb-04 7:28
David Crow6-Feb-04 7:28 
GeneralRe: C++ Question. Pin
WREY6-Feb-04 8:01
WREY6-Feb-04 8:01 
GeneralRe: C++ Question. Pin
David Crow6-Feb-04 8:05
David Crow6-Feb-04 8:05 
GeneralRe: C++ Question. Pin
WREY6-Feb-04 9:01
WREY6-Feb-04 9:01 
My apology!

In my over-excitement I must have mistyped something because when I went back over the first sample and retyped it properly, everything worked! Big Grin | :-D

With the same degree of sobriety, I retyped the second sample over, and interestingly that is the one which isn't working now. The compiler produced the following message: "subscript requires array or pointer type". Here's the code.
short tree[5][5] = {0};
void Func(short* treeArray);
Func(&tree[5][5]);
                                                            
void Func(short* treeArray)
{
   for(short i=0; i<5; ++i)
   {
       for(short j=0; j<5; ++j)
           cout<<treeArray[i][j] <<' ';   // error occurring here!!
   }
}
The reason why I initially reported the second sample had worked, was because I had accessed it as a single dimension array. This time (as you can see from the sample) I am accessing it as a two-dimensional array and the compiler is producing the error message shown above.

For the fun of it, I did enter some data into the 'tree' array to see if it gets printed (which is what happened when I originally accessed it as a single dimension), but now, it's not even getting compiled.

Confused | :confused:

William

Fortes in fide et opere!
GeneralRe: C++ Question. Pin
David Crow6-Feb-04 9:08
David Crow6-Feb-04 9:08 
GeneralRe: C++ Question. Pin
WREY6-Feb-04 9:36
WREY6-Feb-04 9:36 
GeneralRe: C++ Question. Pin
Antti Keskinen6-Feb-04 11:24
Antti Keskinen6-Feb-04 11:24 
GeneralRe: C++ Question. Pin
WREY8-Feb-04 5:57
WREY8-Feb-04 5:57 
GeneralRe: C++ Question. Pin
Michael Dunn6-Feb-04 9:05
sitebuilderMichael Dunn6-Feb-04 9:05 
GeneralRe: C++ Question. Pin
WREY6-Feb-04 10:00
WREY6-Feb-04 10:00 
QuestionHow to put a CRebar or CRebarCtrl in a dialog based application? Pin
bin89226-Feb-04 6:42
bin89226-Feb-04 6:42 
AnswerRe: How to put a CRebar or CRebarCtrl in a dialog based application? Pin
Antti Keskinen6-Feb-04 11:32
Antti Keskinen6-Feb-04 11:32 
GeneralA million thanks!!! Best wishes Pin
bin89227-Feb-04 18:43
bin89227-Feb-04 18:43 
AnswerRe: How to put a CRebar or CRebarCtrl in a dialog based application? Pin
alex.barylski15-May-04 23:36
alex.barylski15-May-04 23:36 
Questionhow can I activate the mouse wheel for a CFormView? Pin
DanYELL6-Feb-04 6:29
DanYELL6-Feb-04 6:29 
AnswerRe: how can I activate the mouse wheel for a CFormView? Pin
Antti Keskinen6-Feb-04 11:52
Antti Keskinen6-Feb-04 11:52 
General,how to create a toolbar in dialog based Pin
Anonymous6-Feb-04 6:08
Anonymous6-Feb-04 6:08 
GeneralRe: ,how to create a toolbar in dialog based Pin
Alexander M.,6-Feb-04 6:17
Alexander M.,6-Feb-04 6:17 
GeneralRe: ,i m using MFC not win32 Pin
Zeeshan Bilal6-Feb-04 6:33
Zeeshan Bilal6-Feb-04 6:33 
General,how to create a toolbar in dialog based Pin
Anonymous6-Feb-04 6:07
Anonymous6-Feb-04 6:07 
GeneralCombo Box Pin
C++NewBe6-Feb-04 5:28
C++NewBe6-Feb-04 5:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.