after my first useless post, i just read your post properly and edited accordingly. what is happening is you have a function that has two data types declared, for example:
CODE
int char myFunction();
that's my understanding of the compiler error (as int and char are two different kinds of data type).
if you only want to return one kind of data type, then you would just take out the data type you don't want.
if you want to use multiple data types, use this method:
make the function return a pointer to void, i.e. do this:
CODE
void *myFunction();
that will return a pointer to ANY DATA type you like. you have to be careful with this however, that the calling function knows what data type the pointer holds or at least knows how big the data is. for instance, if myFunction returns an int, and you interpret it as returning a char, you're going to lose 3 bytes of data. be careful when using void pointers.
if you want, after calling the function, you might want to convert the pointer to a typed pointer to avoid type confusion. i.e., if you know that an int is being returned, to avoid any future problems, try something like this:
CODE
int* myPointer;
myPointer = (*int)myFunction();
(*int) just converts the void pointer returned by myFunction() into an int pointer.
sorry if that confused more than helped
also, i don't know anything about malloc, as i've never had to use it. sorry

ok! good luck mate!
Reply