Results 1 to 6 of 6

Thread: loading array values directly

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    11 N 78 E
    Posts
    110
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default initializing array values upon declaration

    I want to load 9 predetermined strings and 8 predetermined integers to two different arrays. I have seen code of the form:
    Qt Code:
    1. char *namelist[] = {"Ram", "Shyam", "Dhyaan",};
    2. int numlist[] = {0, 1, 4, 2, 5, 3, 6, 11,};
    To copy to clipboard, switch view to plain text mode 
    But I want to know some things:
    1. what is the * for in the first statement?
    2. since a string is already a character array and I need to create an array of strings, don't I need to write char *namelist[][] (two []-s)?
    3. is the comma necessary before the closing brace?
    4. is the semicolon necessary after the closing brace?
    Last edited by jamadagni; 7th January 2006 at 15:45. Reason: making title clearer
    Penguin #395953 using Qt for open-source development on X11 using C++ and
    Python via PyQt

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.