문제

#include <stdio.h>
int main ()
{
unsigned char a=250,b=20, c;
c=a+b;
printf ("%d\n",c);
return 0;
}

What can I do for it to show 270? Besides declaring c as int.

도움이 되었습니까?

해결책

Unsigned char's (assuming char is only eight bits) can only represent 28 numbers, from 0 to 255. You'll need to use another type such as int to represent this.

다른 팁

I'm sorry but you just can't , an unsigned char can hold a maximum of 255

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top