Thread: How to assign array of pointers to pointers, to content of static array?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    How to assign array of pointers to pointers, to content of static array?

    Code:
    char myData[90][3][50];   //90 rows, 3 columns, each block 50 chars long   
    char **tableData[90] = {NULL};  
    
    const char* text;
    text = sqlite3_column_text(stmt, col_index);
    
    text_lenght = strlen(text) + 1;         // add 1 to get null 
    strncpy(myData[row_index][c_index], text, text_lenght);
    //top line in a loop for all rows and each column    <--EDIT the assignment is outside the column loop within the row loop.
    
    
    tableData[row_index] = myData[row_index]; <--?Warning on this line
    I need tableData to correctly point to contents of myData but it's not happening.
    The warning is:
    Code:
     : warning C4047: '=' : 'char ** ' differs in levels of indirection from 'char (*)[50]'
    During run time I can see myData properly populated how I expect. However, tableData is filled with bad pointers...

    Any help is appreciated.
    Thanks.
    Last edited by tommy00b; 06-30-2009 at 07:13 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array of Pointers to Arrays
    By Biozero in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 02:31 PM
  2. Array of struct pointers - Losing my mind
    By drucillica in forum C Programming
    Replies: 5
    Last Post: 11-12-2005, 11:50 PM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM

Tags for this Thread