Click here to Skip to main content
15,899,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: mfc control variable problem Pin
Michael P Butler1-Feb-04 9:37
Michael P Butler1-Feb-04 9:37 
GeneralRe: mfc control variable problem Pin
Qraven1-Feb-04 9:57
Qraven1-Feb-04 9:57 
GeneralBitmaps again! Pin
Dennis L1-Feb-04 9:10
Dennis L1-Feb-04 9:10 
GeneralRe: Bitmaps again! Pin
CodeBrain2-Feb-04 0:42
CodeBrain2-Feb-04 0:42 
GeneralRe: Bitmaps again! Pin
John R. Shaw2-Feb-04 1:29
John R. Shaw2-Feb-04 1:29 
GeneralCharacters Pin
seth.jackson1-Feb-04 9:03
seth.jackson1-Feb-04 9:03 
GeneralRe: Characters Pin
Robert A. T. Káldy2-Feb-04 13:46
Robert A. T. Káldy2-Feb-04 13:46 
GeneralC++ Question. Pin
WREY1-Feb-04 9:00
WREY1-Feb-04 9:00 
What I'm trying to do, is to pass a 2-dimensional array as an argument to a function. In one trial and error case, I was able to get a clean compile, but the program crashed when run. In another case, the program produced one compile error stating that the subscript required an array or pointer type.

My feeling is that the one compile error is more like the truth. Here's the code.
// passing an array this way allows you to pass the size of it
short limit = ReadThisLevel( (&tree)[SZ][SZ] );
...                                                         
short ReadThisLevel(short* tree)
{
   short i, j;
   // other variables defined and initialized here
   for(i=0, lim=0; i<lmt; ++i)
   {
      // etc.
      for(j=0; j<SZ; ++j)
      {
         node = tree[i][j];   // compile error here!!
         // etc.
      }
    }
   return lim;
}
Leaving the code the way it is (as shown in the sample here), but make the following change to that one line, produced this other compiler message, "illegal indirection"
node = *(*(tree+i)+j);   // other compile error message!!
FWIW, 'tree' is defined as:

short tree[SZ][SZ]; // SZ is of type 'const short'

Thanks for any insight.

Unsure | :~

William

Fortes in fide et opere!
GeneralRe: C++ Question. Pin
Ryan Binns1-Feb-04 17:19
Ryan Binns1-Feb-04 17:19 
GeneralRe: C++ Question. Pin
WREY2-Feb-04 1:34
WREY2-Feb-04 1:34 
GeneralAnother MFC Question Pin
Dev5781-Feb-04 8:57
Dev5781-Feb-04 8:57 
GeneralRe: Another MFC Question Pin
Diddy1-Feb-04 9:03
Diddy1-Feb-04 9:03 
GeneralRe: Another MFC Question Pin
Dev5781-Feb-04 9:45
Dev5781-Feb-04 9:45 
GeneralRe: Another MFC Question Pin
Roger Wright1-Feb-04 10:44
professionalRoger Wright1-Feb-04 10:44 
GeneralRe: Another MFC Question Pin
Roger Allen2-Feb-04 0:53
Roger Allen2-Feb-04 0:53 
General&quot;Volume Control&quot; question Pin
User 66581-Feb-04 8:31
User 66581-Feb-04 8:31 
GeneralRe: &quot;Volume Control&quot; question Pin
Michael P Butler1-Feb-04 9:06
Michael P Butler1-Feb-04 9:06 
GeneralRe: &quot;Volume Control&quot; question Pin
Diddy1-Feb-04 9:10
Diddy1-Feb-04 9:10 
GeneralThanks! Pin
User 66581-Feb-04 9:20
User 66581-Feb-04 9:20 
GeneralProblem With Making New Project Pin
Rassul Yunussov1-Feb-04 7:48
Rassul Yunussov1-Feb-04 7:48 
GeneralRe: Problem With Making New Project Pin
Michael P Butler1-Feb-04 8:07
Michael P Butler1-Feb-04 8:07 
GeneralRe: Problem With Making New Project Pin
anonimous1-Feb-04 22:52
anonimous1-Feb-04 22:52 
GeneralRe: Problem With Making New Project Pin
Michael P Butler1-Feb-04 22:58
Michael P Butler1-Feb-04 22:58 
GeneralRe: Problem With Making New Project Pin
Anonymous1-Feb-04 23:28
Anonymous1-Feb-04 23:28 
GeneralRe: Problem With Making New Project Pin
Rassul Yunussov2-Feb-04 5:39
Rassul Yunussov2-Feb-04 5:39 

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.