Hi all,

Quite a basic question for most of you; I am trying to obtain length of a string < char name[MAX_ENTRIES][MAX_NAME_SIZE] > for use in a for loop that will perform isalpha.

for (int j=0; j < &name.length(); j++)

I am getting error 2228: left of '.length' must have class/struct/union type upon compile.

Can anyone please offer me some guidance?

This is a simple win32 console application. See attached code.

Re: Using .length() with multidimensional char array ? (Help) 80 80

How exactly do you want to get length?!!
The only way I know of is using <string.h> There is a strlen(char *s) function which return the strings length :D

Re: Using .length() with multidimensional char array ? (Help) 80 80

rodkay, actually I can help you in c#. In c# you can use GetLength() to get multi dimensional array. Use like this:

 for (int j = 0; j < myjaggedarraymutidim[i].GetLength(0); j++)
                {
                    for (int k = 0; k < myjaggedarraymutidim[i].GetLength(1); k++)
                    {
                        Console.Write(" "+myjaggedarraymutidim[i][j, k]+" ");
                    }

                    Console.WriteLine();
                }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.