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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yes
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.
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.
ASKER