Thread: array of structures as an argument

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    3

    array of structures as an argument

    Hi,
    I m having some problems with a callback function. Let me explain it through code...
    Code:
    //I have this structure//
    
    typedef struct 
    {
    	int cisliceee;
    	GtkWidget*nalepka;
    	int poziceee;
    }vstup;
    //and an array of these structures//
    vstup* v[16];
    
    /*and in this callback function I want a pointer to one element of that array, and then work inside of the structure of this particular element*/
    
    void cudl_stisknut(GtkWidget *widget,vstup*v[])
    {   
    	if (v[]->poziceee=7){
    		gtk_main_quit();
    	}
    can anyone tell me what do I do wrong? I just want it to be the way that if the element that emits the signal has a value stored in its poziceee and it equals 7 then to execute the quit function...

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    1) vstup* v[16] is not an array of structures. It's an array of pointers that could point to some structures, should you ever create any.
    2) Do you want just a pointer to a single vstup object? Then just do that: vstup *v.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    1
    can u teach me c++

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading the file, and filling the array of structures
    By BlackOps in forum C Programming
    Replies: 13
    Last Post: 07-12-2009, 02:03 PM
  2. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  3. accessing an array of structures
    By creative in forum C Programming
    Replies: 4
    Last Post: 12-27-2007, 12:52 PM
  4. Array of Structures: Sorting
    By Drainy in forum C Programming
    Replies: 3
    Last Post: 04-13-2005, 09:55 AM
  5. trying to initialize an array of structures
    By dreamgoat in forum C Programming
    Replies: 4
    Last Post: 09-26-2004, 05:33 PM

Tags for this Thread