Thread: A simple Array issue

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2011
    Location
    UK
    Posts
    5

    A simple Array issue

    Hey there, I'm fairly new to C++ so please bear with me as I almost insult your intelligence with this simple question

    Code:
     char *nu_array[] = {"HELLO", "WORLD"};
    
       char **p = nu_array;
    
       for(int i = 0; i != 6; i++ ){
    
           cout << *(*p + i) << endl;
    I've first created an array of char pointers, and fed into it 2 string literals. I'm then assuming that the original array becomes 2 dimensional; with each element containing each literal, and down a level so to speak each character of said literal.

    Assuming that this above assumption is right, how do I go about manipulating said array. I've toyed about with the code and just managed to extract the "Hello'.
    Also, all the examples I've seen seem to require a size be stated before hand to manipulate it. Is this the only way I can do it?
    Last edited by TastySauceCode; 09-19-2011 at 05:59 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2nd array simple issue (IMPORTANT!)
    By Kadmany in forum C Programming
    Replies: 1
    Last Post: 04-23-2011, 06:46 AM
  2. simple programming issue!
    By ke121885 in forum C Programming
    Replies: 5
    Last Post: 09-27-2009, 06:57 PM
  3. Simple issue please help
    By te5la in forum C++ Programming
    Replies: 5
    Last Post: 09-17-2008, 12:11 PM
  4. Simple issue with bytes
    By Nositi in forum C Programming
    Replies: 6
    Last Post: 03-25-2008, 11:06 AM
  5. Simple issue but I am STUCK
    By jedispy in forum C++ Programming
    Replies: 2
    Last Post: 12-01-2006, 02:02 AM