Thread: passing struct as reference

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    19

    passing struct as reference

    Hey im trying to pass a struct by reference to change one of its variables inside the void function. There is my code:

    Code:
    typedef struct info_{
    	MYSQL*	p_Conn;
    	char* 	Host;
    	char* 	User;
    	char* 	Password;
    	char* 	Database;
    }info;
    
    int main(){
            ....
            info 	ConnInfo;
            Initiate_mysql(&ConnInfo);
    }
    
    void Initiate_mysql(info *ConnInfo){
    	(*ConnInfo).p_Conn = mysql_init(NULL);
    	...	
    }
    im getting an error in execution because of ConnInfo declaration... do i have to allocate something?
    Last edited by ltcabral; 03-13-2008 at 10:20 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assignment HELP!!
    By cprogrammer22 in forum C Programming
    Replies: 35
    Last Post: 01-24-2009, 02:24 PM
  2. Replies: 1
    Last Post: 12-03-2008, 03:10 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Passing by reference not always the best
    By franziss in forum C++ Programming
    Replies: 3
    Last Post: 10-26-2005, 07:08 PM
  5. Problem with OpenGL tutorial
    By 2Biaz in forum Windows Programming
    Replies: 18
    Last Post: 09-16-2004, 11:02 AM