1832550 Members
3076 Online
110043 Solutions
New Discussion

Pro*C Error

 
SOLVED
Go to solution
Dennis Handly
Acclaimed Contributor

Re: Pro*C Error

>But i don't understand why & should be removed. Can you please explain?

I already did. %s wants a char*. A char[] gets converted to a char*. But what you have gives:
warning #2144-D: a value of type "char (*)[20]" cannot be used to initialize an entity of type "char *"
char *p = &buf;

>warning #2181-D: argument is incompatible with corresponding format string conversion
>printf("%6d %2d %6.2f %4.2f\n", weyer_order_no, count_knives, roll_size, prod_order_tons);"

If you are happy with the answers please read the following on how to assign points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33
>prod_order_tons is of type int.

An int doesn't match %4.2f, only a double matches.

>warning #2181-D: argument is incompatible
with corresponding format string conversion
>scanf("%f", price);
>here price is of type float.

scanf(3) wants pointers:
scanf("%f", &price);
NDhivya
Advisor

Re: Pro*C Error

Hi Dennis,

Thanks a lot.

Now, we get the below error,

/usr/ccs/bin/cc -c +DD64 -I. -I../lib -I/u01/dba/oracle/product/1012ias/precomp/public down_cards.c
"down_cards.c", line 315: warning #4212-D: mismatch between character pointer
types "unsigned char *" and "char *"
varcopy(uid,uidx);
^

Here,
#define varcopy(x,y) x.len=strlen(strcpy(x.arr,y))

Declarations:
char uidx[20];
struct { unsigned short len; unsigned char arr[20]; } uid;

Please suggest.
Dennis Handly
Acclaimed Contributor

Re: Pro*C Error

>warning #4212-D: mismatch between character pointer types "unsigned char*" and "char*"

You can either ignore it, suppress it (+W4212) or use a hammer:
#define varcopy(x,y) x.len=strlen(strcpy((char*)(x.arr),y))

I'm not sure you want to change the type of "arr".
NDhivya
Advisor

Re: Pro*C Error

Thanks a lot for your valuable suggestions Dennis. I helped us a lot.

Regards,
Dhivya
NDhivya
Advisor

Re: Pro*C Error

With the help of Dennis we could solve the issues.