What is the minimum value of char type?

Sir / madam,
My question is

What is the minimum value of char type. Select the one correct answer.
a. 0
b. -215
c. -28
d. -215-1

Advance Thanks,
R.Rengaraj
{Java Certification Quiz}
{On this forum my 19th Question.}

Replies

  • Mahesh Dahale
    Mahesh Dahale
    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
    sarveshgupta
    @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
    rengaraj
    Sir,
    Thanks for your reply.
    R.Rengaraj
  • pradeep_agrawal
    pradeep_agrawal
    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
    sarveshgupta
    Mr Rengaraj has to confirm the right answer for the question..May be you are right Pradeep
  • rengaraj
    rengaraj
    Dear Mahesh,
    You quoted 0 to be the answer.
    But it is for unsigned char . not for char.

    mahesh_dahale
    What is the minimum value of char type. Select the one correct answer.
    a. 0
    b. -215
    c. -28
    d. -215-1
    R.Rengaraj
  • rengaraj
    rengaraj
    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_agrawal
    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
    R.Rengaraj

You are reading an archived discussion.

Related Posts

OffiSync Version: 4 File Size: 459 License: Free Operating System: Windows XP,Windows Vista,Windows 7 Wouldn't it be nice if you could make a mash-up of Microsoft Office and Google Docs,...
hi, can you please suggest me some book on rocket motor/engines which can be available in india preferably north. i couldn't get it by searching on google. thank you
hi , i am jatin kashyap, i am from jalandhar, punjab, india. i am 2nd year student of Mechanical engineering. I know its very long time to me for my...
Check Website Page Speed & Load Time with Google Google Webmaster Tools Labs has come up with another excellent tools which not only reports you with the web pages load...
Im a sophomore student in ee. We have a lab project with color sensors and I need assistance in circuit design. We have to design a circuit which must identify...