Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Arrays

  1. #1
    New to the CF scene
    Join Date
    Feb 2011
    Location
    San Antonio, Tx
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Arrays

    I am trying to read a character from keyboard and place into array.

    Code:
    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

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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.
    OracleGuy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •