Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Function with pointer parameter
[b][red]This message was edited by kikijas at 2007-3-26 1:40:11[/red][/b][hr]
I have part of my c-codes as below:
int Funct1(UL32 * para1, UL32 para2);
typedef unsigned long UL32;
typedef struct STRUCTDEF1
unsigned char Data3;
unsigned int Data2;
typedef struct STRUCTDEF2
unsigned int Data1;
unsigned long val2;
. . .
int Funct1(UL32 * para1, UL32 para2)
I am using the open watcom compiler. I need to build this program into a DOS 32-bit executable program. I am facing the problem below:
When I call the Funct1 by passing the parameter as following:
The compiler gives the error message "Type of parameter 1 does not agree with previous definition". There are 2 notes saying that "Source conversion type is 'struct _STRUCTDEF2 *'" and "target conversion type is 'unsigned long *'".
So I try to cast the "&val" to UL32 when I call the "Funct1()" in the main function, as shown in my codes above.
This does solved the problem, but will it pass the correct parameters to the function "Funct1"?
How can I display the value of the "para1" in Funct1?
Highly appreciated if anyone can help to answer the above questions.
0 · ·