Re: newbie...please help




Andrew Poelstra wrote:
> Bart wrote:
> char animals [ ] [3][6] = {
> > > "cow","pig","dog","rat","bat","hen","eel","ant","cat","ox","owl","yak","ram­","bee","doe"}

> > I don't get this either. A 3D array is declared then initialised with
> > 2D content. Am I missing something? It works better without the [3] and
> > the [1].
> >

> Because a string is in itself an array, a 2D array of strings would
> actually be a 3D array.
> That's why you shouldn't learn C without programming experience: It's
> hellishly complicated.
>
> Ex. animals[0][0][0] == 'c', whereas animals [0][0] = "cow" and animals
> [0] = [the address in memory of "cow"]
>

I think I get it now, the init data should have looked like:

{{"cow","pig","dog"},{"rat","bat","hen"},{"eel","ant","cat"},{"ox","owl","yak"},{"ram","bee","doe"}};

instead of the linear:

{"cow","pig","dog","rat","bat","hen","eel","ant","cat","ox","owl","yak","ram","bee","doe"};

but the 'magic' of C makes that correct.


Bart

.



Relevant Pages

  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
    (microsoft.public.fox.helpwanted)
  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
    (microsoft.public.vc.mfc)
  • Re: Array Type Mismatch
    ... Dim resultAs String ... I am still somewhat confused as to why nothing is stored in the array. ... Public Function TextBoxGetLine(....arguments... ...
    (microsoft.public.access.formscoding)
  • Help in Spanish translation of the description of UDFs
    ... functions of minimum / maximum values among elements of an array column. ... GETALLWORDS- Inserts the words from a string into a global dimensioned ... WORDTRAN- Searches a character string for occurrences of a first word, ... ARRAYSUM- Returns the sum of all or a specified range of numeric (and/or ...
    (microsoft.public.fox.helpwanted)