`signed` — C Keyword
`signed` — C Keyword
The signed keyword in C: explicitly marks an integer type as signed.
`signed` — C Keyword
The signed keyword in C: explicitly marks an integer type as signed.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
signed (C)Explicitly marks an integer type as signed. Redundant for int, short, long, and long long (they are signed by default), but meaningful for char whose signedness is implementation-defined.
signed char sc;
signed short ss;
signed int si;
signed long sl;
#include <stdio.h>
int main(void) {
signed char sc = -42;
signed int si = -1000;
printf("%d\n", sc); /* -42 */
printf("%d\n", si); /* -1000 */
/* Contrast: unsigned char wraps */
unsigned char uc = (unsigned char)(-1);
printf("%u\n", uc); /* 255 */
return 0;
}
signed char when you need a guaranteed signed 8-bit value, or use int8_t from <stdint.h>.int main() {
// Pick one facility from this reference page.
// Write the smallest program that exercises its main precondition,
// complexity rule, or lifetime constraint before scaling up.
return 0;
}