answersLogoWhite

0


Best Answer

There is no defined range of values in C. The built-in types all have ranges that are defined in <stdint.h>, <limits.h> and <float.h>. These ranges are implementation-defined, they are not defined by the language or by the standard. The standard only defines minimum guarantees such that a char is always at least 8 bits long (CHAR_BIT) and that an int is at least as long as a short which is at least as long as a char.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

The range of char in C language is -128 to +127

Mahesh M

MCA

University Of Hyderabad

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

Write a program to find second largest number in a collection of integers?

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

total: 0-128

printable: 32-127

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

-32768 to 32767

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the numerical range of a char?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the range of integer char float for a 16-bit computer?

Consult your limits.h and math.h. For char it will be -128..127 or 0.255 (signed and unsigned).


What are range of character data type in c plus plus?

The range of character data types in C++ is the set of characters in the host's character set. It is inappropriate to consider the numerical range of such things as characters, because that depends on the particular codeset involved, such as ASCII, EBCDIC, UNICODE, KANJI, etc. Doing that leads to non-portable code, and lazy programming practices. Do not write code that depends on the collating sequence of the character set, or the numerical difference between two characters. Type char can be signed or unsigned, the value range is -128..127 or 0..255 respectively.


How are char -type constants and char-type variables interpreted when used as operands with a relational operator?

As integers, within range -128..127 if signed, 0..255 if unsigned.


How character data type accept int?

An int and a char are both integral types such that a char is always guaranteed to be within the range of an int, because an int is at least as long as a short which is at least as long as a char (in bits). Converting the other way, from int to char, is not guaranteed to work, but we can guard against this by testing the int value is within the required range prior to conversion.The reason we use an int as opposed to a char in certain cases is because an int can represent values that a char cannot. This is useful in functions which would normally return a char value, but where we also need to cater for other values. Those other values could be used to indicate an error condition, for instance.


Can we assign int and float values to the character data type in c language?

Yes, but this will result in an implicit conversion and possible narrowing. A char is always at least 8-bits in length, but an int may be 4 bytes in length (the actual length is implementation-defined) thus assigning an integer value outwith the range of a char will result in narrowing. Similarly when assigning a float (typically 16-bits in length); the fractional component will be lost and the integer value may be narrowed. An unsigned char is only guaranteed to hold values in the range 0 through 255 and a signed char is only guaranteed to hold values in the range -127 through +127. Any values outwith those integer ranges may result in narrowing. Most modern architectures support twos-complement notation thus the signed range becomes -128 through +127, however this cannot be guaranteed across all implementations. Also, a "plain" char may be signed or unsigned depending on the implementation but is a distinct type from an explicitly signed or unsigned char. A plain char is only guaranteed to hold positive integer values in the range 0 through 127 across all implementations.

Related questions

What is the numerical range of char?

-32768 to 32767


What is the numerical range for the earthquake's intensity?

hiIDK!!


What is the range of integer char float for a 16 bit computer?

Consult your limits.h and math.h. For char it will be -128..127 or 0.255 (signed and unsigned).


What is the range of integer char float for a 16-bit computer?

Consult your limits.h and math.h. For char it will be -128..127 or 0.255 (signed and unsigned).


What is the numerical range for credit scores?

one to ten


What are range of character data type in c plus plus?

The range of character data types in C++ is the set of characters in the host's character set. It is inappropriate to consider the numerical range of such things as characters, because that depends on the particular codeset involved, such as ASCII, EBCDIC, UNICODE, KANJI, etc. Doing that leads to non-portable code, and lazy programming practices. Do not write code that depends on the collating sequence of the character set, or the numerical difference between two characters. Type char can be signed or unsigned, the value range is -128..127 or 0..255 respectively.


Can the range be used to describe both categorical and numerical data?

yes because if you have categorical data you need the range for the value of the numbers so it would be the same for numerical data


Can numerical data have a range median or mode?

Yes. They must have a range and median. They may or may not have a mode.


How are char -type constants and char-type variables interpreted when used as operands with a relational operator?

As integers, within range -128..127 if signed, 0..255 if unsigned.


Data in order from smallest to largest or vice- versa?

range ranking


Is char a identical to char a?

'char a' and 'char a' are identical.


How character data type accept int?

An int and a char are both integral types such that a char is always guaranteed to be within the range of an int, because an int is at least as long as a short which is at least as long as a char (in bits). Converting the other way, from int to char, is not guaranteed to work, but we can guard against this by testing the int value is within the required range prior to conversion.The reason we use an int as opposed to a char in certain cases is because an int can represent values that a char cannot. This is useful in functions which would normally return a char value, but where we also need to cater for other values. Those other values could be used to indicate an error condition, for instance.