I'm trying to input these letters into and array using the following an tex

[TEX]char Letters[26] ={"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
[/TEX]

my complier has an error reading
too many initializers

Please help

Get a better compiler. And post a real code example.

Get a better compiler. And post a real code example.

His compiler's fine.

You're really living up to your the interests you list in your profile tonight, aren't you?

If you're using chars, then use single quotes instead of double. Double quotes are for strings (more then 1 char).
So it would look like this:

char Letters[26] = {'a','b','c',    /*etc etc etc*/    };

But the easier way to do this, would be to initialize them as a string :

char Letters[] = "abcdefghijklmnopqrstuvwxyz";
    cout << "There are " << strlen(Letters) << " letters in the array";

output: There are 26 letters in the array Or you could use std::strings, because of the plain simplicity of it:

std::string Letters = "abcdefghijklmnopqrstuvwxyz";
cout << "There are " << Letters.size() << " letters in the array";
cout << "The first is " << Letters[0] << ", the last is " << Letters[Letters.size()-1];

output:

There are 26 letters in the array
The first is a, the last is z
Be a part of the DaniWeb community

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