Thread: Assign struct member value to struct member value

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2010
    Location
    USA
    Posts
    5

    Assign struct pointer array member value to struct pointer array member value

    I'm having a little trouble understanding how to do this properly. It seems like it's something simple that I have just glossed over.

    Here are the struct definitions in my header...

    Code:
    struct source {
    	int num;
    	int *av[128];
    	char *tcpip[128];
    	int *tcpport[128];
    	char *label[256];
    	int *active[128];
    	char *sdip[128];
    	char *hdip[128];
    	char *aip[128];
    }source;
    
    struct display {
    	int num;
    	char *tcpip[128];
    	int *tcpport[128];
    	int *src[128];
    }display;
    Here is the line in which I'm trying to assign values where mon_selected is a simple int used to index a selected monitor.

    Code:
    drag_label(video_bg, source.label[display.src[mon_selected]], samp.x, samp.y, oldx, oldy);
    ...aaaand the error that I can't seem to get rid of without assigning display.src[mon_selected] to a temporary variable. ick.

    Code:
    src/touchscreen.c:57: error: array subscript is not an integer
    It looks to me like I am not dereferencing the display.src member properly. My guess is that it is not following the pointer to the actual value. I'm not sure how to fix it though.

    Enlighten me! Please and thank you.
    Last edited by thahemp; 10-13-2010 at 08:32 AM. Reason: Edited title for clarity

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help assignment due tomorrow
    By wildiv in forum C Programming
    Replies: 6
    Last Post: 01-27-2010, 08:38 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM
  5. Bi-Directional Linked Lists
    By Thantos in forum C Programming
    Replies: 6
    Last Post: 12-11-2003, 10:24 AM