MAX7716 发表于 2023-2-23 11:19:49

unsigned的用法求助

这里的unsigned应该怎么用?
#include <stdio.h>

int main()
{
int a = 123;
int b = 0567;
int c = 0xabc;
printf("a = %d\n",a);
printf("b = %o\n",b); printf("b = %d\n",b);
printf("c = %x\n",c);
printf("c = %X\n",c); printf("c = %d\n",c);

unsigned int d = 0xffffff;
printf("d = %u",d);

}

ExiaGN001 发表于 2023-2-23 11:27:49

unsigned 就是 无符号的意思,上限增加一倍,下限变为0
只能用在 char, short, int, long, long int, long long ,long long int
这些类型以及其对应数组/指针类型
和signed冲突
有用设置最佳谢谢
页: [1]
查看完整版本: unsigned的用法求助