Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-28-2011, 05:31 AM   #1
LQ Newbie
Registered: Jul 2011
Posts: 1

Rep: Reputation: Disabled
invalid conversion

I am writing a function, and I'm getting the error "invalid conversion from 'void(*)(u_char* , u_int , void* )' to 'void(*)(tuple*,u_char*,u_int,void*)
Any help would be appreciated.
Old 07-28-2011, 06:18 AM   #2
Senior Member
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,533

Rep: Reputation: 334Reputation: 334Reputation: 334Reputation: 334
You haven't supplied enough information for anyone to truly point out the error in your code. However, below is a sample program that perhaps you can use to figure out where you went wrong with your programming.
#include <stdio.h>

typedef unsigned int  u_int;
typedef unsigned char u_char;

typedef struct
  u_int x, y, z;
} tuple;

typedef void (*Function)(tuple*, u_char*, u_int, void*);

void myFunction(tuple* param1, u_char* param2, u_int param3, void* param4)
   printf("I'm here!\n");

void otherFunction(Function f)
   tuple t;
   u_char uc;
   u_int  ui;
   void*  v;

   f(&t, &uc, ui, v);

int main(void)
   // passing function to another function

   // declaring a function pointer
   Function f = &myFunction;

   tuple t;
   u_char uc;
   u_int  ui;
   void*  v;

   f(&t, &uc, ui, v);

   return 0;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
invalid conversion from `int*' to `socklen_t*' r350 Programming 5 10-02-2011 06:34 PM
Invalid conversion from bool fsshl Programming 3 07-19-2011 07:42 PM
Invalid conversion from ‘char’ to ‘packet_t’ mcpoon Programming 4 05-25-2010 04:55 AM
error: invalid conversion from `void*' to `char*' pstevens57 Programming 2 03-10-2009 02:57 PM
invalid conversion from `char' to `const ch predatorz Programming 3 11-15-2008 02:00 PM

All times are GMT -5. The time now is 11:38 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration