CrazyEngineers
  • What is the minimum value of char type?

    rengaraj

    Member

    Updated: Oct 27, 2024
    Views: 2.7K
    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.}
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Mahesh Dahale

    MemberDec 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).
    Are you sure? This action cannot be undone.
    Cancel
  • sarveshgupta

    MemberDec 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?
    Are you sure? This action cannot be undone.
    Cancel
  • rengaraj

    MemberDec 5, 2009

    Sir,
    Thanks for your reply.
    R.Rengaraj
    Are you sure? This action cannot be undone.
    Cancel
  • pradeep_agrawal

    MemberDec 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
    Are you sure? This action cannot be undone.
    Cancel
  • sarveshgupta

    MemberDec 9, 2009

    Mr Rengaraj has to confirm the right answer for the question..May be you are right Pradeep
    Are you sure? This action cannot be undone.
    Cancel
  • rengaraj

    MemberDec 9, 2009

    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
    Are you sure? This action cannot be undone.
    Cancel
  • rengaraj

    MemberDec 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_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
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register