[AccessD] Brain Fart regarding arrays

Stuart McLachlan stuart at lexacorp.com.pg
Sat Jan 7 22:52:19 CST 2023


The WIn API documentation still uses Hungarian notation.

As an example, take a look at the absolutely fundamental CreateWindowEX function that is 
at the  core of every WIndows application.

HWND CreateWindowExA(
  [in]           DWORD     dwExStyle,
  [in, optional] LPCSTR    lpClassName,
  [in, optional] LPCSTR    lpWindowName,
  [in]           DWORD     dwStyle,
  [in]           int       X,
  [in]           int       Y,
  [in]           int       nWidth,
  [in]           int       nHeight,
  [in, optional] HWND      hWndParent,
  [in, optional] HMENU     hMenu,
  [in, optional] HINSTANCE hInstance,
  [in, optional] LPVO



On 7 Jan 2023 at 23:16, Arthur Fuller wrote:

> Rocky,
> 
> The use of i and j goes back at least as far as the K&R first edition.
> Prior to that I have no idea. The prefix is pretty much a BASIC and
> VBA thing, so far as I know. A lot of the C and C++ code I read
> doesn't bother with either prefix or suffix to indicate type. If
> there's ever a doubt, you can always look at the Declare statements, I
> guess is their thinking. I have come to prefer the C-style, which also
> eliminates the "As" stupid word -- except when it's used in a cast.
> 
> But ultimately, when in Spain...
> 
> On Sat, Jan 7, 2023 at 10:28 PM Rocky Smolin <rockysmolin2 at gmail.com>
> wrote:
> 
> > Old guys quiz:
> >
> > I see you are using (like me) intI and intJ for counters in a For
> > Next loop.
> >
> > Who knows the etymology intI and intJ?
> >
> > r
> >
> > On Sat, Jan 7, 2023 at 6:40 PM jack drawbridge
> > <jackandpat.d at gmail.com> wrote:
> >
> > > Arthur,
> > >
> > > Here's a method that may satisfy your requirement. It's been a
> > > long time since I did multi-dimension anything. Hope it's helpful.
> > >
> > > '=====arthur fuller
> > >
> > >
> > > Sub Fill_2DArray()
> > >     Dim intI As Integer, intJ As Integer
> > >     Dim Arr1 As Variant, arr2 As Variant
> > >     Arr1 = Array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,
> > >     31) arr2 = Array(0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31,
> > >     30, 31) Dim TwoD(0 To 1, 0 To 12) As Integer
> > >
> > >     ' Fill array with values.
> > >     For intI = 0 To 1
> > >         For intJ = 0 To 12
> > >             Select Case intI
> > >                 Case 0
> > >                     TwoD(intI, intJ) = Arr1(intJ)
> > >                 Case 1
> > >                     TwoD(intI, intJ) = arr2(intJ)
> > >             End Select
> > >             Debug.Print "TwoD(" & intI & " , " & intJ & ")  is " &
> > > TwoD(intI, intJ)
> > >         Next intJ
> > >         Debug.Print
> > >     Next intI
> > > End Sub
> > >
> > > On Sat, Jan 7, 2023 at 8:54 PM Arthur Fuller
> > > <fuller.artful at gmail.com> wrote:
> > >
> > > > I can't remember at the moment how to populate a 2D array. I
> > > > know what
> > I
> > > > want: 13 x 2:
> > > >
> > > > Row 1: (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
> > > > Row 2: (0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
> > > >
> > > > I seem to recall being able to populate it in two steps, passing
> > > > the
> > rows
> > > > as described above, but I can't recall the syntax. I've been
> > > > spending
> > too
> > > > much time in C and C++ and have forgotten my VBA. 
> > > >
> > > > --
> > > > Arthur
> > > > --
> > > > AccessD mailing list
> > > > AccessD at databaseadvisors.com
> > > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > > Website: http://www.databaseadvisors.com
> > > >
> > > --
> > > AccessD mailing list
> > > AccessD at databaseadvisors.com
> > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > Website: http://www.databaseadvisors.com
> > >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> 
> 
> -- 
> Arthur
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list