Вопрос

#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