Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@mahesh-E2tZ3t • Dec 4, 2009
What is the minimum value of char type. Select the one correct answer.
a. 0
b. -215
c. -28
d. -215-1
char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).
-
@sarveshgupta-txtmu5 • Dec 4, 2009
@Mahesh: char type can also be 8-bit character for C/C++
In Java we have it to be 16 -bit I suppose
Although it will have a minimum value of 0 for both the cases as you have told.
Am I correct? -
@rengaraj-89Rrct • Dec 5, 2009
Sir,
Thanks for your reply.
R.Rengaraj -
@pradeep-agrawal-rhdX5z • Dec 9, 2009
In C a variable of type char can also hold a -ve value and the range is from -128 to 127. So the min. value taht a char variable can have in C is -128.
If someone want that char variable hold only positive values in C then he/she need to use "unsigned char" instead of "char" while declaring the variable.
-Pradeep -
@sarveshgupta-txtmu5 • Dec 9, 2009
Mr Rengaraj has to confirm the right answer for the question..May be you are right Pradeep
-
@rengaraj-89Rrct • Dec 9, 2009
Dear Mahesh,
You quoted 0 to be the answer.
But it is for unsigned char . not for char.
mahesh_dahaleWhat is the minimum value of char type. Select the one correct answer.
a. 0
b. -215
c. -28
d. -215-1R.Rengaraj
-
@rengaraj-89Rrct • Dec 9, 2009
Dear Pradeep,
You are right, Unsigned Char has a min. value of 0.
While,
Char has a min value of -128.
Excellent discussion.
Thanks to all of you.
pradeep_agrawalIn C a variable of type char can also hold a -ve value and the range is from -128 to 127. So the min. value taht a char variable can have in C is -128.
If someone want that char variable hold only positive values in C then he/she need to use "unsigned char" instead of "char" while declaring the variable.
-PradeepR.Rengaraj