View Full Version : Arrays

10-02-2011, 08:21 PM
I am trying to read a character from keyboard and place into array.

char* asciiArray[ARRAY_SIZE];
this is my declaration

I tried standard cin and cin.get but it does not seem to work. What is best way to read and store in array. Or am i missing a library up top with iostream and cstring.

Can somebody help? Thank you

10-02-2011, 11:04 PM
Well it depends exactly what are doing with the string. The code you show is declaring an array of string pointers. If you are intending to declare a single string of length ARRAY_LENGTH then you should remove the asterisk.

If you mean an array of strings then are you allocating memory for each of those strings?

Without seeing more code it is hard to say what your problem is.