Link to home
Start Free TrialLog in
Avatar of zizi21
zizi21

asked on

strcpy : pointer targets in passing argument 1 of ‘strcpy’ differ in signedness

hi,

my strings are unsigned and i am passing it to strcpy and i am getting this warning.

but the program runs fine. wouldn't i lose value because signed can only support up to 127 when
unsigned supports 0 to 255.

I also got this error for strlen.

tks
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zizi21
zizi21

ASKER

do i typecast to char * to remove the warnings then ?
yes
Avatar of zizi21

ASKER

thanks
>> my strings are unsigned

Do you mean you use unsigned char ? Why ?

The char type is designed to hold characters. Whether the system uses a signed or unsigned value doesn't matter. When you work with strings, use char (not signed char or unsigned char).


>> wouldn't i lose value because signed can only support up to 127 when unsigned supports 0 to 255.

That doesn't matter. That's an implementation detail you shouldn't worry about. Whether char is implemented to be signed or unsigned does not change the amount of characters it can hold, and it does not change how you use it.