0

I am biginner in C and PRO*C and need some help. I have a structure as below:

  typedef struct pt_st{
   char (*s_no)[100];
   char (*s)[100];
    } pt_st;

I have a function like c_info which calls post function:

int c_info(pt_st ir_st)
{
int   li_result = 0;
li_result = post(ir_st.s_no)
} 

and post function is :

int post(char *is_st)
{
//do something
}

When I compile my program , I get three errors:

warning: passing arguments post from incompatible pointer type
warning: passing arguments post make integer from ponter without cast
warning: passing arguments post make ponter from integer without cast

Does anyone kow how can I fix this?

Thank you!

2
  • To declare a array of char do char arr[42]. Doing as you do (char (*parr)[42]) declares a pointer (parr) to an array of 42 chars. Commented May 25, 2015 at 10:57
  • 1
    Note: I retagged, cause I think the OP means the Oracle thing. Commented May 25, 2015 at 11:00

1 Answer 1

2

pt_st.s_no as well a pt_st.s both declare a pointer to an array of char.

So the function post() needs to expect such, like:

int post(char (*s_no)[100]);

If the shown definition of int post(char * is_st) cannot be changed, then call it like this:

pt_st s = ... /* some initialisation */

int result = post(*(s.s_no));
Sign up to request clarification or add additional context in comments.

10 Comments

Thanks for your reply, but still i get the same warning.
@Dax: Which warning? Your question mentions 3 different warnings? And also for which of my both proposals?
I still get all these three warnings : warning: passing arguments post from incompatible pointer type warning: passing arguments post make integer from ponter without case warning: passing arguments post make ponter from integer without case for yur first proposal i.s. int post(char (*s_no)[NULL_BIG_SEQ_NO]);
@Dax: Sry, but are you sure you are editing/compiling the right files? Also the error messages you quote are not 100% what any compiler would issue: "ponter"? "case"?
Also check which lines the compilers tells you for where the warnings occur.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.