arithmetic on pointer to an incomplete type?

This is a discussion on arithmetic on pointer to an incomplete type? within the C Programming forums, part of the General Programming Boards category; I keep getting the 'arithmetic on pointer to an incomplete type' on all of the following: Code: strcpy ( dataList[i], ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    19

    arithmetic on pointer to an incomplete type?

    I keep getting the 'arithmetic on pointer to an incomplete type' on all of the following:

    Code:
    strcpy ( dataList[i], buffer2 );
    Code:
            lineLen = strlen(buffer2);
            for ( j=0; j < lineLen ; j++)
                dataList[i][j] = buffer2[j];
    Code:
    printf("\ngetData 7.0 : dataList[%d] : <%s>", i, dataList[i]);
    getchar();
    What am I doing wrong T-T?

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by Volair
    What am I doing wrong T-T?
    Not posting enough information to definitively answer your question.

    How are dataList and buffer2 declared?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    19
    Sorry ^ ^; I forgot those important details o o;

    dataList is:
    char dataList [5][MAX];
    passed as:
    fp = getData ( dataList, fp, &linesR);
    recieved as:
    FILE *getData ( char dataList[5][], FILE *fp, int *linesR){

    buffer2 is:
    char buffer2 [MAX];

    Does it have to do with the fact that one is 1D and the other is 2D?

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    You can't do this:
    Code:
    FILE *getData ( char dataList[5][], FILE *fp, int *linesR){
    You need to specify the rightmost dimensions, not from the left. You can leave the leftmost one empty.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    19
    >< Programming lords shoot me now.

    Thanks Dave. I'll try not to be an idiot anymore, but I can't promise that o o

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-26-2009, 02:43 PM
  2. strings Vs. Char pointers
    By aijazbaig1 in forum C Programming
    Replies: 49
    Last Post: 02-13-2008, 09:51 AM
  3. Script errors - bool unrecognized and struct issues
    By ulillillia in forum Windows Programming
    Replies: 10
    Last Post: 12-18-2006, 04:44 AM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-30-2005, 12:21 AM
  5. Glib and file manipulation
    By unixOZ in forum Linux Programming
    Replies: 1
    Last Post: 03-22-2004, 09:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21