Hello all,
I've heard that it's good practice to always declare char variables as signed or unsigned.
Could anyone comment? Is it worth it?
In addition, under what circumstances should one declare one or the other?
I note that when I tried to compile a program under Linux with all unsigned chars, I got errors when using printf: "warning: pointer targets in passing argument 1 of ‘sprintf’ differ in signedness".
Do printf etc. always require signed chars to be entered or is there a way of telling it a given char (or string of chars) is unsigned?
Many thanks,
-- Joe
I've heard that it's good practice to always declare char variables as signed or unsigned.
Could anyone comment? Is it worth it?
In addition, under what circumstances should one declare one or the other?
I note that when I tried to compile a program under Linux with all unsigned chars, I got errors when using printf: "warning: pointer targets in passing argument 1 of ‘sprintf’ differ in signedness".
Do printf etc. always require signed chars to be entered or is there a way of telling it a given char (or string of chars) is unsigned?
Many thanks,
-- Joe